合并两个tiff文件 [英] Merge two tiff files

查看:139
本文介绍了合并两个tiff文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,



我有一个要求,合并两个tiff文件。问题是当合并一个tiff与其他时,我必须给一个位置其他tiff图像。

假设我有一个tiff有100个图像和5个图像中的其他图像。当我合并这两个tiff并且我给出一个位置20,那么新的tiff应该包含来自tiff 1的图像从1到20然后是tiff 2到25的图像以及来自tiff 1的26到105张图像。





提前致谢。

Hello friends,

I am having a requirement, to merge two tiff files.Problem is when merging one tiff with other, i have to give a position to other tiff image.
Suppose i have one tiff with 100 images and other of 5 images.When i merge these two tiff and i give a position 20, then new tiff should contain images from tiff 1 starting from 1 to 20 and then images from tiff 2 till 25 and again from 26 to 105 images from tiff 1.


Thanks in advance.

推荐答案

您可以使用三个 System.Drawing.Bitmap 对象来执行此操作:http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx [ ^ ]。< br $>


通过 Bitmap 构造函数读取两个文件,并创建一个新文件位图所需大小的实例。在目标上绘制两个源位图。对于绘图,从目标位图创建 System.Drawing.Graphics 的实例,使用 System.Drawing.Graphics.DrawImage中的一个绘制方法:

http:/ /msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx [ ^ ]。



将目标位图保存为TIFF:

You can do it using three System.Drawing.Bitmap objects: http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx[^].

Read two files by the Bitmap constructor, and create a new Bitmap instance of required size. Draw two source bitmaps on the target one. For drawing, create an instance of System.Drawing.Graphics from the target bitmap, draw using one of the System.Drawing.Graphics.DrawImage methods:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^].

Save the target bitmap as TIFF:
myBitmap.Save(outputStream, ImageFormat.Tiff);





-SA


如果你想看到更多ab如何合并两个文件vb.net 而不会出现问题有。你可以在这里查看这些代码。
if you want see more about how to merge two files vb.net without getting the issue you are having. you can take a look at those codes here.


这篇关于合并两个tiff文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆