TIFF loading performance is very low
See original GitHub issuePrerequisites
- I have written a descriptive issue title
- I have verified that I am using the latest version of Magick.NET
- I have searched open and closed issues to ensure it has not already been reported
Description
When loading a large (10mb) TIFF image, creating the MagickImage object takes roughly 1200ms on my machine (still around ~1000 using the OpenMP version); vs the sub 20ms it takes with System.Imaging on my machine. This is weird because in my experience the ImageMagick JPEG decompressor for instance systematically performs better than Microsoft’s libraries while keeping in the same order of magnitude. Here we’re talking 2 orders of magnitude difference which leads me to believe something is wrong.
Steps to Reproduce
I have zipped and uploaded the image here for convenience
string imgLocationTIFF = @"c:\path\to\image.tif";
Bitmap bmp;
ImageMagick.MagickImage imgM;
Image img;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
imgM = new ImageMagick.MagickImage(imgLocationTIFF);
bmp = imgM.ToBitmap();
stopwatch.Stop();
rtfBox.Text += String.Format("ImageMagick TIFF: {0}\r\n", stopwatch.ElapsedMilliseconds);
stopwatch = new Stopwatch();
stopwatch.Start();
img = Image.FromFile(imgLocationTIFF);
bmp = (Bitmap)img;
stopwatch.Stop();
rtfBox.Text += String.Format("Microsoft TIFF: {0}\r\n", stopwatch.ElapsedMilliseconds);
Produces:
Magick.NET-Q8-x64
ImageMagick TIFF: 1376
Microsoft TIFF: 13
Magick.NET-Q8-OpenMP-x64
ImageMagick TIFF: 927
Microsoft TIFF: 12
I have tried “helping” the lib by doing
imgM = new ImageMagick.MagickImage(System.IO.File.ReadAllBytes(imgLocationTIFF), ImageMagick.MagickFormat.Tif);
But the results are the same
System Configuration
- Magick.NET version: Magick.NET-Q8-OpenMP-x64 and non-OpenMP 7.17.0.1
- Environment (Operating system, version and so on): Win10, i7700k, 16GB ram
- Additional information:
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
TIFF Performance still very slow - anything I can do about ...
Smaller 20D files are almost as slow, even with LZW compression. The RAW files load in an instant, but the slow tiff performance...
Read more >Performance issues when loading some .tif files #623
I have some 2k x 2k .tif files which I believe are compressed. I noticed that loading these with imageio was very slow....
Read more >Computer is slow when Windows Photo Gallery displays ...
This behavior causes slow system performance and a significant increase in the memory usage of the computer. Resolution. Diagnose and fix the problem ......
Read more >TIFF files saving very slow compare to PSD
Since about two months, after an update, when I save my TIFF files, when ready retouching it, it became ridiculously slow. Saving stands...
Read more >Slow 4K TIFF image sequence on M.2 drives
I have 64Gb of super fast memory, an AMD Threadripper and 4 x M.2 Samsung Pro Drives (the fast ones), a new Nvidia...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Make sure you keep the copyright header when you integrate those file. Will close this issue now.
p.s. I noticed that you also committed the folder
packages
in your project. It is a binary folder that you want to include in the .gitignore list.Alright that makes sense. I’ll integrate the System.Drawing codebase directly into my project to avoid distributing additional DLLs but otherwise I think you can close this issue if nothing else is expected!