ImageSharp Resize is 2x faster on Windows but 2x slower on Sandy Bridge + Linux compared to System.Drawing library #2003
-
I'm running resize method on an image with the following code using ImageSharp:
But when I run the same resize code using the same image on Linux, ImageSharp gets 2x slower compared to System.Drawing. The output quality in all cases look the same to me, and it also doesn't matter which image or what newSize I'm using. BTW thanks for such an amazing library! Since our code is executed under linux, we are currently in the process of transitioning from System.Drawing library to ImageSharp... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 25 replies
-
You need to provide a benchmark when making these kinds of claims. |
Beta Was this translation helpful? Give feedback.
-
Just did a run of our parallel, large image LoadResizeSave benchmarks and got these results on my Linux VM:
|
Beta Was this translation helpful? Give feedback.
-
My theory here is that System.Drawing on linux isn't actually doing the same operation as we are or windows does. This issue in libgdiplus looks like it could be related mono/libgdiplus#730 |
Beta Was this translation helpful? Give feedback.
We've encountered same difference in performance in 2021.
System.Drawing
is clearly cheating when re-encoding image without any modifications within the same format. Your example image before and after re-encoding withsystemDrawingSrcImage.Save(saveStream, ImageFormat.Jpeg);
yields binary equal file which is highly unlikely for a lossy format. I don't know if GDI is open source so I can't pinpoint the exact place where this happens.To prove that, let's provide actual quality parameter to the encoder:
Your original…