Closed atjn closed 1 year ago
FWIW, the Windows CI failure is unrelated to this and should be fixed with commit https://github.com/kleisauke/wasm-vips/commit/5823efbb0e29380c5736c1fff8a76470fc69077d.
Cool!
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.
Yeah that is a bit weird.
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: https://github.com/lovell/sharp-libvips/pull/89.
Good to know, thanks!
Would it make sense for this port to enable some mozjpeg
features by default? I would be happy to play around with it, if you are open to it.
Would it make sense for this port to enable some
mozjpeg
features by default?
Good question. I think we shouldn't deviate too much from libvips default settings. The mozjpeg settings can be controlled with these options: https://github.com/kleisauke/wasm-vips/blob/a51b0e2c9d1687558e9abf3e6b95def701277ca8/lib/vips.d.ts#L7316-L7331
Which are guarded in libvips with the HAVE_JPEG_EXT_PARAMS
condition:
https://github.com/libvips/libvips/blob/7e961b46718b32d654a1c10e9261cdbbd5ccb9b6/libvips/foreign/vips2jpeg.c#L613-L670
I'm aware that sharp has a shortcut option that would enable these settings at once (it also enables optimize_coding
by default), see:
https://sharp.pixelplumbing.com/api-output#jpeg
A better option would be to provide a polyfill for sharp, based on wasm-vips, as discussed in this Twitter thread: https://twitter.com/lovell/status/1395710714799665163
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.