jxl.js icon indicating copy to clipboard operation
jxl.js copied to clipboard

Support for embedded image decoding

Open WhoseTheNerd opened this issue 2 years ago • 7 comments

Decoding support for base64 embedded jpeg xl images would be nice. Any plans for that?

WhoseTheNerd avatar Jan 07 '23 10:01 WhoseTheNerd

I managed to do this by adding el.src.startsWith("data:image/jpegxl;base64,") to the MutationObserver if list and all jxlSrc used in caching context gets encodeURIComponent(jxlSrc)

Resulting jxl.js looks like this

WhoseTheNerd avatar Jan 07 '23 11:01 WhoseTheNerd

Thanks, but what's the real world use case for this?

niutech avatar Jan 07 '23 16:01 niutech

It allows me not to deal with image files, since they are all embedded into single file, i.e. all images, js, css and etc. You can think of it as something similar to SingleFile.

WhoseTheNerd avatar Jan 07 '23 20:01 WhoseTheNerd

The MIME type image/jpegxl is still not standardized by IANA. There is a feature request for another MIME type image/jxl, so we cannot reliably use this one or another to detect JPEG XL images. It' the best to wait until it gets standardized.

niutech avatar Jan 08 '23 11:01 niutech

How to do this with blob image data?

redthing1 avatar Apr 28 '23 03:04 redthing1

@redthing1 See https://github.com/niutech/jxl.js/issues/9#issuecomment-1374445726

niutech avatar Apr 28 '23 19:04 niutech

The MIME type image/jpegxl is still not standardized by IANA. There is a feature request for another MIME type image/jxl, so we cannot reliably use this one or another to detect JPEG XL images. It' the best to wait until it gets standardized.

It would be fine to check for either MIME type as there are no conflicts with other types.

QINGCHARLES avatar Jun 06 '23 18:06 QINGCHARLES