Platinum Partner

Concatenating Multiple Tiff Images inside .NET Applications

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.
// [C#]

//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();

   }
}

//[VB.NET]

'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 image As TiffImage = CType(Aspose.Imaging.Image.Load(MyDir&"Testconct.tif"), TiffImage)

'Create an instance of TiffImage and load the source image
Using image1 As TiffImage = CType(Aspose.Imaging.Image.Load(MyDir&"sample1.tif"), TiffImage)

' Create an instance of TIffFrame and copy active frame of source image
Dim frame As TiffFrame = TiffFrame.CopyFrame(image1.ActiveFrame)


' Add copied frame to destination image
image.AddFrame(frame)
save the image with changes.
image.Save()
EndUsing

EndUsing
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}