Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is jpeg_like option in cwebp supported on Sharp lib #4294

Open
thangcqUET opened this issue Dec 12, 2024 · 1 comment
Open

Is jpeg_like option in cwebp supported on Sharp lib #4294

thangcqUET opened this issue Dec 12, 2024 · 1 comment
Labels

Comments

@thangcqUET
Copy link

thangcqUET commented Dec 12, 2024

Hi, I want to convert JPEG to WEBP. But the size of WEBP file is more heavy than the JPEG. I found out this discussion talk that we should use lossy mode and we can use jpeg_like option to choose automatically the quality setting for best result. This option is in cwebp. Does Sharp lib support jpeg_like option for lossy conversion?
The webp discussion

@lovell
Copy link
Owner

lovell commented Dec 12, 2024

Hi, no, this is not exposed via libvips.

You might be able to approximate it by increasing the "quality" setting, perhaps by around 10-15 at a guess. The logic to convert from a given "quality" to WebP's base encoding coefficient is here (QualityToJPEGCompression is used for jpeg_like):

https://github.com/webmproject/libwebp/blob/e4f7a9f0c7c9fbfae1568bc7fa5c94b989b50872/src/enc/quant_enc.c#L323-L355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants