-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support JPEG XL images #21
Conversation
Everything compiles now, and |
+ prefer lcms2 over skcms.
Brotli is a C-only library.
Great! I still need to think about whether to distribute JPEG XL support by default. Issue libvips/build-win64-mxe#40 might also be relevant here. I had a look at the build, and fixed a few things, see: The -DCMAKE_CROSSCOMPILING_EMULATOR="$EMSDK_NODE;--experimental-wasm-threads;--experimental-wasm-simd" Doesn't seem to work. I think it's safe to ignore that error for now. emsdk probably needs to update its Node version to 16.4.0 or higher to match the final SIMD opcodes (see emscripten-core/emsdk#1064). |
We rely on libvips' thread pool instead.
|
Wow, that is some nice and speedy work you made here! Feel free to commit all those changes to this branch. I can also do it, but I think it might attribute the changes to me. |
I would strongly argue for distributing JXL support by default. However, I do think it would be completely reasonable to disable JXL parsing by default, but make it possible to turn it on at runtime through the API somehow. Or you can count on the user to disable JXL themselves if they feel it is a safety issue for them. My reasoning: All browsers support methods of delivering JXL images today, so that when browsers eventually support it by default, it will instantly be used (see picture, image-set). I already use JXL on some sites today to gather experience before they are supported by default. You could argue that we can just wait and enable support the moment that the first browser supports JXL, but it is very likely that some systems will be using By using a flag, you are also able to keep that flag well after JXL has been supported in browsers, in case you still don't think that it is mature in There is also the case of non-browser workflows. Some software already supports JXL, and I have heard of places where JXL is the new standard. If somebody wants to build a quick webapp that handles these images, |
Yeah, highway recommends using the V8 engine directly to build it, exactly because SIMD isn't supported in node 14. Another solution is to force a newer node version. I thought the same as you; if it compiles and works, then just let it be and wait for the inevitable upstream patch that solves this problem. |
I just pushed it to the branch associated with this PR. |
IMO the best path forward would be to include libjxl by default and then support vips.blockUntrustedSet(true); Or specifically disable JPEG XL features with: vips.operationBlockSet("VipsForeignLoadJxl", true);
vips.operationBlockSet("VipsForeignSaveJxl", true); You could even apply the JXL-specific block by default, and tell people to disable the block in their code if they want to have JXL support. I will see if I can figure out how to make a PR for supporting those two functions. |
I think exposing Another concern with enabling JPEG XL support by default is that the binary size ( To fix this, we could enable the GModule implementation and build a dynamically loadable module for libjxl ( If you want, I can look into this next week, it would probably require dropping this patch: wasm-vips/build/patches/glib-emscripten.patch Lines 169 to 189 in 5e3b052
|
If you are willing to spend the time on it, I think that would be awesome! It would also allow us to support much less used formats like AVIF, SVG and JPEG 2000 without worrying about file size ballooning. With that said, I don't think it is strictly necessary for the libjxl implementation. It will only increase load times |
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.
Thank you! This will be in v0.0.4.
Commit 995eba0 builds this as a dynamically loadable module ( const vips = await Vips({
// Disable dynamic modules
dynamicLibraries: []
}); |
Awesome! |
v0.0.4 is now available. Dynamic modules can be disabled on the playground by passing the Also, |
@kleisauke Do I understand right that JPEG-XL is built only when building with dynamic modules support? If so, can "Compiling jxl" be skipped when using |
By the way, ICYMI: Chrome removes the experimental JPEG-XL in upcoming versions, and other browsers never shipped it. That makes a lot of people unhappy, but the chances for it to become a common format seem pretty low if this goes through as currently expected. https://bugs.chromium.org/p/chromium/issues/detail?id=1178058 |
The vips.blockUntrusted(true);
// Or:
// vips.operationBlock('VipsForeignLoadJxl', true)
// vips.operationBlock('VipsForeignSaveJxl', true) (see commit google/oss-fuzz@890953f) This libvips binding is the first to ship with JPEG XL support by default, and I intend to maintain/release this as a dynamic module in further releases. We could argue for having this opt-out by default on web (see I'm happy to accept a PR that adds a
It looks like Google already changed its tone from "we will remove it" to "no support at this time". |
I'm not sure 3rd-party publisher's interpretation should be taken for a source of truth. I didn't see change in tone on the public communication on the bug. |
You're right, I should probably link CNET's article here, which includes the same statement from Google.
Indeed, it's a bit curious that it was communicated this way. |
I think it's just "business-speak" language. |
As I see it, JPEG XL is going to be the dominant image format on the web, and probably also outside the web. It would be nice to start the process of supporting it now, so that it is completely ready and stable when people start using it.
The
libjxl
package makes it very clear that it isn't secure yet, but I don't see that as a major issue, because:vips
to disable any call to thelibjxl
package, or write their own guards against JPEG XL filesThe goal of this PR is to build a working implementation that can handle >90% of images without crashing.
libjxl
is still under major development, so ironing out all bugs and optimizing speed could be a complete waste of time. We can always do that later when the package stabilizes a bit more.Things to do:
Things that are not included in this PR: