Sharp: how does sharp compress jpg / png files

Created on 25 Jun 2020  路  3Comments  路  Source: lovell/sharp

I will create a kind of image provider to create different sizes from the original. Still researching, i would like to understand how sharp is compressing jpg or png files. Is it a linear compression, that treats all parts of the image the same, or does it offer something like tinypng does (smart lossy compression)?

This feature means that the image is analyzed before compressing. Different areas are compressed in a different quality depending on the image structure. This allows a stronger compression without a loss of quality.

I was wondering if sharp provides a feature like this, so far i did not find it in the docs... Thanks for info

question

All 3 comments

sharp depends on libvips, which depends on lossy libjpeg-turbo and lossless libpng for compression.

You can compile libvips from source with additional support for libimagequant, which allows for quantised and therefore lossy PNG.

https://sharp.pixelplumbing.com/install#custom-libvips

I hope this information helped. Please feel free to re-open with more details if further assistance is required.

thanks for that info, much appreciated. Sorry for the late reply...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iq-dot picture iq-dot  路  3Comments

OleVik picture OleVik  路  3Comments

emmtte picture emmtte  路  3Comments

genifycom picture genifycom  路  3Comments

natural-law picture natural-law  路  3Comments