Infinite image.Save of tiff

In our current project we’re trying to convert tiffs to black and white tiffs as follows


Using stream As New FileStream(Path.Combine(inputFolder, attachment), FileMode.Open)
Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(stream)
Dim fileName = Path.GetFileNameWithoutExtension(attachment)
Using outstream = New FileStream(Path.Combine(outputFolder, fileName + “.tif”), FileMode.Create)
image.Save(outstream, New TiffOptions() With {.Compression = TiffCompressions.CcittFax4})
End Using
End Using
End Using

For a few images we had to stop the conversion after it was stuck for more than ten minutes on the image.Save() call. The size of the tiffs is rather small and several other tiffs were no problem.
It consistently fails on the same tiffs.
I attached two of such failing tiffs to this post.

Can we get a better insight on what’s the delay?
What do we need to get these images converted by Aspose?

Hi Boris,

Thank you for using Aspose products.

I have evaluated your presented scenario with your sample images while using the latest version of Aspose.Imaging for .NET 2.1.0. I am afraid, the said issue wasn’t replicated on my end, in fact the results were saved in fraction of a second. This could be due to the reason that you are probably using an older version of Aspose.Imaging for .NET component. I would recommend you to download the latest assemblies from the download link provided above and give them a try on your end. Hopefully you will not experience the said issue with latest release.

Sample Code:


Dim sw1 As New Stopwatch()
Dim sw2 As New Stopwatch()
sw1.Start()
Using image = CType(Aspose.Imaging.Image.Load(myDir & “0316_0001.tif”), RasterImage)
sw1.Stop()
Dim options = New TiffOptions()
options.Compression = TiffCompressions.CcittFax4
Dim outputStream = New FileStream(myDir & “output.tiff”, FileMode.Create)
sw2.Start()
image.Save(outputStream, options)
sw2.Stop()
End Using
Console.WriteLine(“Elapsed to Load: {0}”, sw1.Elapsed)
Console.WriteLine(“Elapsed to Save: {0}”, sw2.Elapsed)


Please feel free to write back in case you have further questions.

Hey Barbar,


Thanks for your reply.
We weren’t aware there was a new version of the library available.
After updating, the issue hasn’t appeared again.

Thanks

Hi Boris,


Thanks for your feedback. It is good to know that your issue has been fixed.

Please feel free to contact us for any further assistance. We will be more than happy to extend our support.

Best Regards,