This Technical tip explains how to concatenate multiple TIFF images using Aspose.Imaging for .NET.

This tip submitted by sherazam on 2013-09-03 23:34:14. It has been viewed 4529 times.
Rating of 3.6 with 46 votes



This Technical tip explains how to concatenate multiple TIFF images using Aspose.Imaging for .NET. Sometimes you need to concatenate a TIFF Image into another TIFF image and Aspose.Imaging supports this feature of concatenating multiple Tiff images. This article exhibits the TIFF image concatenation feature of Aspose.Imaging for .Net API. We will use TiffImage and TiffFrame classes to concatenate multiple TIFF images. We can use both standard methods, from file and from stream, to concatenate TIFF images. First, we will create a copy of the destination image to avoid any alteration to original image. Source images could be concatenated directly to the original destination image; it�s depending upon the requirement. Then we will create instances of images and load images from local disk. Now we will copy the active frame of source image using CopyFrame method of TiffFrame class and add that copied frame in destination image with the help of AddFrame method of TIffImage class. Finally we will save image back to local disk.


//Create a copy of original image to avoid any alteration
File.Copy(MyDir + "sample.tif", MyDir + "Testconct.tif", true);


//Create an instance of TiffImage and load the copied destination image
using (TiffImage image = (TiffImage)Aspose.Imaging.Image.Load(MyDir + "Testconct.tif"))
{
//Create an instance of TiffImage and load the source image
using (TiffImage image1 = (TiffImage)Aspose.Imaging.Image.Load(MyDir + "sample1.tif"))
{
// Create an instance of TIffFrame and copy active frame of source image
TiffFrame frame = TiffFrame.CopyFrame(image1.ActiveFrame);
// Add copied frame to destination image
image.AddFrame(frame);
// save the image with changes.
image.Save();

}
}




More tips

Help your fellow programmers! Add a tip!