Home > Code > C# > Concatenating Multiple Tiff Images inside .NET Applications

Concatenating Multiple Tiff Images inside .NET Applications

by sher azam   on Sep 03, 2013   Category: C#   |  Views: 1683    |  Points: 25   |  Gold 


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

Overview: Aspose.Imaging for .NET

Aspose.Imaging for .NET is an image processing & manipulation component that allows developers to create, edit, draw or convert images in their .NET application. It allows developers to convert image files to PSD, BMP, JPEG, PNG, TIFF and GIF formats. Moreover a set of pens, brushes and fonts can be used to draw images or add new elements & text to existing images. Aspose.Imaging for .NET works well with both web & windows applications. Moreover, it adds the support for Silverlight platform.

More about Aspose.Imaging for .NET

- Homepage of Aspose.Imaging for .NET: http://www.aspose.com/.net/imaging-component.aspx

- Download Aspose.Imaging for .NET: http://www.aspose.com/community/files/51/.net-components/aspose.imaging-for-.net/default.aspx

- More Technical Tips for Image Processsing: http://docs.aspose.com:8082/docs/pages/viewpage.action?pageId=10846657



Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts