Replies: 1 comment 1 reply
-
That's not true. The library will always use the input format unless specified otherwise.
There is no
Why are you comparing specialized optimization services like tinypng? ImageSharp detects many metadata properties and will attempt to encode output images using the same configuration. In some instances this is lossy and expected (jpeg) and you might be better specifying a higher quality to encode at to preserve more of the detail. There's no mechanism for detecting best options. What you are asking for is machine learning. |
Beta Was this translation helpful? Give feedback.
-
Currently, I use ImageSharp to resize images and save them in their original formats, via the codes below:
Here I resized the image first if it's too big via
ResizeMode.Max
.What I want to do next, is to optimize the image similar to the fashion of https://tinypng.com/, where:
The original format is always kept, i.e. jpg/png/gif etc. It seems ImageSharp expects me to pass an specific encoder when encoding.
The compression level should be of a quality I specify (BTW, I can find quality property for
JpegEncoder
andPngEncoder
, but notGifEncoder
). Is it okay to leave every other encoder option on default?If the original image is already compressed to around the ideal level, the re-encoding should not result in significant quality loss or file size increase. This is what I observed from services like tinypng. Better yet, is it even possible to detect this "ideal size" using some sort of metrics and not re-encode?
Your advice would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions