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
Use mozjpeg instead of libjpeg-turbo #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @atjn,
Thanks for the PR! The reason that I used libjpeg-turbo instead of mozjpeg was that the latest version of mozjpeg (4.0.3) was a bit out-of-sync. But you're right, we could just build against mozjpeg's master
branch instead (which is based upon libjpeg-turbo 2.1.3).
Note that libvips resets to libjpeg-turbo's JCP_FASTEST
defaults so this can be considered a "no-op" unless mozjpeg features are explicitly set, see: lovell/sharp-libvips#89.
This will be in v0.0.4.
FWIW, the Windows CI failure is unrelated to this and should be fixed with commit 5823efb. |
Cool!
Yeah that is a bit weird.
Good to know, thanks! |
Good question. I think we shouldn't deviate too much from libvips default settings. The mozjpeg settings can be controlled with these options: Lines 7316 to 7331 in a51b0e2
Which are guarded in libvips with the I'm aware that sharp has a shortcut option that would enable these settings at once (it also enables A better option would be to provide a polyfill for sharp, based on wasm-vips, as discussed in this Twitter thread: |
Hello again :)
I would strongly recommend using
mozjpeg
for JPEG encoding. It is identical tolibjpeg-turbo
, but has some added patches that significantly improves compression without sacrificing image quality. It is used in many popular image suites, including other ports of libvips.If you need to use
libjpeg-turbo
to test bleeding-edge updates, it is very easy to change back to. I can even add a flag to automatically switch between the two if you'd like.