We unfortunately still having the same issue with combining TIFF files. Please address this issue as soon as possible. At this point, we have paid for a license for a full year but not have been able to use it because of this problem.
Please see IMAGINGNET-4155 “Exception combining TIFF images”.
The exception is “Image Export Failed” with the following information:
Inner exception: “Cannot access a disposed object. Object name: ‘TiffFrame’.”
Stack trace:
at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
at Aspose.Imaging.RasterImage.Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
at Aspose.Imaging.Image.Save(Stream stream, ImageOptionsBase optionsBase)
at ImageMan64Test.AsposeFunc.CombineImageFiles(String fpDest, String[] safp) in C:\dev\Testing\AsposeCombineFiles\ImageMan64Test\AsposeFunc.cs:line 345
at ImageMan64Test.frmTestImageMan.btnAspose_Click(Object sender, EventArgs e) in C:\dev\Testing\AsposeCombineFiles\ImageMan64Test\Form1.cs:line 37
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at ImageMan64Test.Program.Main() in C:\dev\Testing\AsposeCombineFiles\ImageMan64Test\Program.cs:line 19
This may or may not help. I have noticed that in the following code fragment:
using (FileStream fileStream = new FileStream(fp, FileMode.Open))
{
using (TiffImage image = (TiffImage)Image.Load(fileStream)) // <=====
{
int nPageCount = image.Frames.Length;
for (int p = 0; p < nPageCount; p++)
{
// Create an instance of TIffFrame and copy frame of source image
using (TiffFrame frame = TiffFrame.CopyFrame(image.Frames[p]))
{
// Add copied frame to destination image
image1.AddFrame(frame);
}
}
}
fileStream.Close();
}
The “TiffImage image = (TiffImage)Image.Load(fileStream)” line always throws the following exception:
Exception thrown: ‘System.NullReferenceException’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
I don’t know if that is related to not being able to save the resulting file or not.
I have shared the feedback with you for shared issue. If there is still an issue then please provide the source file and sample project reproducing the issue. We are sorry for your inconvenience but really wish to assist you further.
I did try the suggested code, that seems to work for single page TIFF files. However, when you modify the code so that multi-paged TIFFs can be combined, that’s when things seem to get into trouble. The project that is attached in the reply above is trying to also handle multi-paged TIFFs. If there is a better way to handle multi-paged TIFF files, please let me know.
By the way, the suggested code is still throwing the following exception when the TIFF is loaded.
Exception thrown: ‘System.NullReferenceException’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
Exception thrown: ' ’ in Aspose.Imaging.dll
I have tried using Aspose.Imaging for .NET 20.12 on my end and the sample project executed without any exception .Can you please try using the suggested version on your end.
I extracted code for your project in sample application attached and it worked fine. Can you please try this or share modified project if your still encounter issue. TestImaging.zip (5.3 MB)