Skip to content
Discussion options

You must be logged in to vote

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 with systemDrawingSrcImage.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:

using var @params = new EncoderParameters(1);
using var qualityParam = new EncoderParameter(Encoder.Quality, quality); // MUST be of type long
@params.Param[0] = qualityParam;

Your original…

Replies: 3 comments 25 replies

Comment options

You must be logged in to vote
2 replies
@mirshokraie
Comment options

@antonfirsov
Comment options

Comment options

You must be logged in to vote
22 replies
@mirshokraie
Comment options

@JimBobSquarePants
Comment options

@mirshokraie
Comment options

@br3aker
Comment options

Answer selected by JimBobSquarePants
@mirshokraie
Comment options

Comment options

You must be logged in to vote
1 reply
@mirshokraie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
5 participants