Hi Jane,
Thank you for further elaboration.
Please check the alternative for your recently shared source code.
C#
//Create an instance of TiffImage and load an existing image
using (TiffImage multiImage = (TiffImage)Aspose.Imaging.Image.Load(myDir + “mytiff2.tif”))
{
//Create an instance of int to keep track of frames in TiffImage
int frameCounter = 0;
//Iterate over the TiffFrames in TiffImage
foreach (TiffFrame tiffFrame
in multiImage.Frames)
{
//Set the current frame to be active
multiImage.ActiveFrame = tiffFrame;
//Create an instance of TiffOptions
var createOptions =
new Aspose.Imaging.ImageOptions.TiffOptions();
//Set the Source of createOptions as FileCreateSource by specifing the location where output will be saved
createOptions.Source =
new FileCreateSource(
string.Format(“{0}\Concat{1}.tif”, myDir, frameCounter),
false);
//Create a new TiffImage having the dimensions of current active frame
using (var tiffImage = (TiffImage)Image.Create(createOptions, tiffFrame.Width, tiffFrame.Height))
{
//Create a copy of active frame to be added to another image
TiffFrame frame = TiffFrame.CopyFrame(tiffFrame);
//Add frame to output image
tiffImage.AddFrame(frame);
//Set the current frame to be active frame for output image
tiffImage.ActiveFrame = frame;
//Remove the first empty frame; By default an empty frame is added to every Tiff image
tiffImage.RemoveFrame(0);
//Save the output image
tiffImage.Save();
}
frameCounter++;
}
}
Above code loads a Tiff image, and saves its frames to individual Tiff files. This way you will process each file with Aspose.Imaging component, assuring that all images are compatible for concatenation. You can then further process these separate frames to be concatenated in a single file as per your requirement.
In your first post, you have mentioned that you are having issue while concatenating non-Aspose generated images with Aspose generated images. Could you please elaborate these problems? As far as I have tried, I am able to concatenate Aspose generated images with the ones downloaded from internet, without observing any exceptions or bad results. Please note that I am using the assemblies from the latest version of
Aspose.Imaging for .NET v2.0.0.
If you are facing any compatibility issues then it is essential for us to study these problematic images. in order to make sure that we are delivering a universal solution. Please be assured that anything you share with us (via private post or email) will not be disclosed to anyone or any party but Aspose team. We collect these samples to re-produce any issue on our end, and we delete such data as soon as the issue gets resolved.