Free Support Forum -

Exception combining TIFF images

Attached is the Visual Studio Solution. (15.0 KB)

fpDest - file path to the file that will hold the combined files.
safp - array of files to combine

In the example program, a directory is entered in the UI. When the Combine button is clicked, all the .tif files in the directory gets combined into a file called AsposeCombined.tif.

In this part of the code:
using (FileStream outputStream = new FileStream(fpDest, FileMode.Create, FileAccess.Write))
image1.Save(outputStream, outputSettings);

the image1.Save call throws the following exception:

Cannot access a disposed object.
Object name: ‘TiffFrame’. Shipment ID: 22399504. Stack Trace: at Aspose.Imaging.DisposableObject.VerifyNotDisposed()
at .(TiffOptions , Int32[][] , Rectangle , Boolean )
at … (Rectangle )
at ​ .( , IList1 , ) at ​ .(Rectangle , , , Int32 , Int32 , ) at . (TiffStreamReader , Rectangle , IPartialArgb32PixelLoader ) at ​ .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader ) at ​ . (Rectangle ) at ​ .( , IList1 , )
at ​ .(Rectangle , , , Int32 , Int32 , )
at . (Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.(Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)
at Aspose.Imaging.FileFormats.Tiff.TiffFrame.(RasterImage , TiffStreamWriter , Boolean , TiffOptions , ExifData , XmpPacketWrapper , Rectangle )
at Aspose.Imaging.FileFormats.Tiff.TiffImage.(TiffStreamWriter )
at Aspose.Imaging.FileFormats.Tiff.TiffImage.SaveData(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(String filePath, Boolean overWrite)
at ImageManager3.ImageUtil.CombineImageFiles(String fpDest, String[] safp, Int32[])

This seems to happen when a lot of files are combined. I don’t know if it’s a totally filesize issue or if it’s the number of files. Usually combining just a few files works.


I have worked with the sample project shared by you using Aspose.Imaging for .NET 20.3. Unfortunately, I am unable to find source files reproducing the issue on your end. Please share the requested files and also give a try to Aspose.Imaging for .NET 20.3 before sharing with us. (6.6 MB)

I have attached the test files that I used to reproduce the issue. If you still do not see the same behavior, just copy the attached files multiple times in the same directory. I did also try using .NET 20.3 and got the same exception above.

Thank you.


I have worked with sample files shared and have been able to observe the issue. An issue with ID IMAGINGNET-3820 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issue status says that it has been resolved. Is there a new release for the fix?


The issue has been marked as resolved in upcoming Aspose.Imaging for .NET 20.5. We will share the notification with you as soon as the product wil be shared online by end of this month.

The issues you have found earlier (filed as IMAGINGNET-3820) have been fixed in this update.