Reading in multi-page TIF and saving individual files is really slow #1222
Unanswered
StarFleetSecurity
asked this question in
Help
Replies: 2 comments 3 replies
-
Which version of Magick.NET are you using? |
Beta Was this translation helpful? Give feedback.
2 replies
-
You can try to solve it this way public static void Test(string filename)
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a 25-page TIF file (about 7MB total size) that I need to split and save into individual files.
I had some old .NET Framework code doing this as below in the OldTiffToTiffs function. Creating the memory stream from the byte array and creating the "TiffBitmapDecoder" in the first few lines would take about 50 ms. Each new frame could be saved and added as a byte array to the "result" list in about 200 ms. So total processing time was about 5 seconds.
I am trying to recreate this functionality with the NewTiffToTiffs funtion using MagickImage in .NET 6 (since System.Windows.Media.Imaging is not available here). The function works just fine, but is prohibitively slow. Just creating the "MagickImageCollection" takes 5 seconds alone. Executing the "ToByteArray" on each image in the collection takes about 1200 ms. If I take out the dithering and compression lines, it is much faster (about 80 ms for each), but I must do the fax compression because we must have it as one bit per pixel and I must do the dithering or the image quality is terrible.
Is there a reason it takes so much longer to load the original TIF with MagickImage? And is there any way to speed up the "ToByteArray" when the dithering and compression are used? Having users wait 30 seconds instead of 5 is no good.
Thanks,
Andrew
Beta Was this translation helpful? Give feedback.
All reactions