Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
4.20/5 (2 votes)
See more:
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.
Posted

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:
C#
myBitmap.Save(outputStream, ImageFormat.Tiff);


—SA
 
Share this answer
 
v2
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900