Replies: 1 comment 1 reply
-
A PNG image is lossless, so it doesn't "compress" the image, it merely writes it to file in a more efficient manor. JPEG however, is a lossy format, which stores only a part of the original information. This is the reason that the Please note that if you change the file extensions, other programs or libraries will not be able to read the image. ImageSharp is one of the few libraries that isn't confused by the file extension to identify the image format. |
Beta Was this translation helpful? Give feedback.
-
I would like to compress images o different formats, ideally for all, but mostly jpeg and png though.
Is there some universal method, like
img.SaveAsync(filePath, 70)
currently my code is like this:
it looks like for jpeg, I need to do this:
but the
PngEncoder
doesn't have aQuality
property,Also I noticed I can save
.png
files using the JpegEncoder, but I'm not sure if this is the most optimal way.Beta Was this translation helpful? Give feedback.
All reactions