Free Support Forum - aspose.com

Merge two tiff files as one page tiff file

Hi,
Can I merge two tiff files as single page tiff file, not multiple page tiff. Can I use Aspose.Imaging for that ?

Thank you .

@esraince

Yes, you can merge the Tiff files using API. Please check the following sample code that will serve your needs.

string dir = @"c:\aspose.work\";

string[] inputFiles = new string[]
{
"TWAIN-6130 A4 600 DUP 256COL_00001.tif",
"TWAIN-6130 A4 600 DUP 256COL_00002.tif",
"TWAIN-6130 A4 600 DUP 256COL_00003.tif",
};

TiffOptions createOptions = new TiffOptions(TiffExpectedFormat.Default);
createOptions.Compression = TiffCompressions.None;

TiffFrame[] frames = new TiffFrame[inputFiles.Length];
for (int i = 0; i < inputFiles.Length; ++i)
{
using (TiffImage input = (TiffImage)Image.Load(dir + inputFiles[i]))
{
frames[i] = TiffFrame.CreateFrameFrom(input.Frames[0], createOptions);
}
}

using (TiffImage output = new TiffImage(frames))
{
using (FileStream fileStream = new FileStream(dir + "ConcatThreeTiffImages Out.tif", FileMode.Create))
{
output.Save(fileStream);
}
}

Hi, thank you for your reply. But what I need is to concatenate two tiff files in one frame not in two frames. So resulting tiff will include only one frame. Code pasted above returns the number of frames as much as the number of files. Is this possible ?

@esraince

Can you please share the source TIFF files and desired output TIFF file with 2 TIFF concatenated in single frame. We will investigate the requirement based on that on our end to help you further.