JPEG XL

Info

rules 57
github 35276
reddit 647

JPEG XL

tools 4225
website 1655
adoption 20712
image-compression-forum 0

General chat

welcome 3810
introduce-yourself 291
color 1414
photography 3435
other-codecs 23765
on-topic 24923
off-topic 22701

Voice Channels

General 2147

Archived

bot-spam 4380

libjxl

Oleksii Matiash
2024-04-16 03:42:02
I'm against non-English not only because of inconvenience, but also because I believe that those who ask must do a little work to be understood by community
Meow
Oleksii Matiash I'm against non-English not only because of inconvenience, but also because I believe that those who ask must do a little work to be understood by community
2024-04-16 04:02:33
They have no respect to others. Chinese is native to me but I don't type in Chinese in an English-major community
2024-04-16 04:03:19
A question of "question" is really rude
Oleksii Matiash
Meow They have no respect to others. Chinese is native to me but I don't type in Chinese in an English-major community
2024-04-16 04:06:29
The same for me, my language is of slavonic group, but I respect others, as everyone should do
Meow
2024-04-16 04:09:28
His question is pretty simple however that adding with -d or -q is okay
w
2024-04-16 04:44:47
btw it's not obvious to someone who doesnt spend all their time online
_wb_
spider-mario (writing in the present tense but I'm not sure if we've changed it) djxl defaults to outputting to linear sRGB because it can't convert back to an ICC profile (as opposed to an enum colour profile), but there's no inherent chopping there (the linear data is unbounded), and the ICC profile is stored in the .jxl file
2024-04-16 04:44:48
1) Maybe defaulting to linear sRGB is a bad choice, and it would make more sense to default to something like Display P3, to avoid the gamut clipping and possible banding issues you'd get when storing the result in a format that uses uint8? Is this a libjxl default or a djxl default? 2) With the new decoder cms api, it should no longer be true that djxl cannot convert back to an ICC profile, right? Maybe djxl is not using the new api yet though, but that should be fixable then.
Demiurge
2024-04-16 04:50:41
Is there a way to tell when clipping occurs during decoding?
_wb_
Meow They have no respect to others. Chinese is native to me but I don't type in Chinese in an English-major community
2024-04-16 04:51:21
Regardless of language, opening a github issue for something that should be rather easy to figure out (it's explained in the repo README.md, in the help screen of cjxl itself, in the man page, etc) is not a great sign of respect. I don't expect people to dig down deep in all the documentation before asking a question, but a minimum amount of RTFM would be nice...
w
2024-04-16 04:52:56
if i said that to my mom i'd be beat
_wb_
Demiurge Is there a way to tell when clipping occurs during decoding?
2024-04-16 04:54:17
We could keep track of out-of-range values when converting from float to uint; it may add a bit of overhead but it might be worth it. Only thing is: even when the input is e.g. just 8-bit sRGB, lossy compression might cause some pixels to get slightly out of range, and then you'd probably not want to get a "gamut was clipped" warning but rather just clip it silently...
w if i said that to my mom i'd be beat
2024-04-16 04:54:41
does your mom know how to open github issues?
w
2024-04-16 04:55:48
she'd know to ask me to open one
2024-04-16 04:55:57
i mean EVERYTHING isnt obvious
2024-04-16 04:57:38
you can extend rtfm to read the code
2024-04-16 04:57:46
and that is even less obvious
2024-04-16 04:57:50
but maybe not to some
_wb_
2024-04-16 04:57:54
but you wouldn't open a github issue, you'd first try to figure it out yourself from the help screen, maybe search the web for some answers, and only if it's still unclear after 2-3 minutes of trying to figuring it out, then consider to open a github issue
w
2024-04-16 04:58:06
even that process isn't obvious
2024-04-16 04:58:48
even for computer literate users
Demiurge
_wb_ We could keep track of out-of-range values when converting from float to uint; it may add a bit of overhead but it might be worth it. Only thing is: even when the input is e.g. just 8-bit sRGB, lossy compression might cause some pixels to get slightly out of range, and then you'd probably not want to get a "gamut was clipped" warning but rather just clip it silently...
2024-04-16 04:58:57
True... but there should be a good way to know when to be silent and when the clipping is significant enough to not be silent.
2024-04-16 04:59:15
Maybe the metadata would have hints
2024-04-16 05:00:56
The metadata says what the original bit depth and color profile is, and when decoding to the same pixel format as the original then there should not be significant clipping.
_wb_
2024-04-16 05:03:00
yeah basically the issue is just when decoding to a different colorspace than the original one, which I think is now no longer something djxl should ever do if it would just use the new cms-enabled decode api.
Demiurge
2024-04-16 05:04:58
If it's an enum color space, does it still need a full CMS to decode to a nonlinear format?
spider-mario
2024-04-16 05:33:27
no, it should know how to encode to all the transfer functions that the enum can express
Meow
2024-04-16 07:35:17
Wonder if people encounter this too https://github.com/libjxl/libjxl/issues/2111
2024-04-16 07:38:16
I didn't set up -e (supposed to be default as 7) and the results for lossy JXL with an Alpha channel are larger than lossy AVIF at the similar DSSIM or SSIMULACRA2 quality value
2024-04-16 07:39:43
Or I need to verify more images with an Alpha channel to get the more comprehensive results
Demiurge
spider-mario no, it should know how to encode to all the transfer functions that the enum can express
2024-04-16 08:05:16
Well that's pretty awesome, so then no CMS is needed to decode to adobe RGB it sounds like
spider-mario
2024-04-16 08:07:46
for jxl files created after the cjxl fix for detection, indeed not
username
Meow I didn't set up -e (supposed to be default as 7) and the results for lossy JXL with an Alpha channel are larger than lossy AVIF at the similar DSSIM or SSIMULACRA2 quality value
2024-04-16 08:09:17
does changing around `--alpha_distance` for cjxl make anything better? https://github.com/libjxl/libjxl/pull/2117
Demiurge
2024-04-16 08:16:43
Yeah, it says that setting it to lossless is usually better
2024-04-16 08:16:53
so alpha_distance=0
spider-mario for jxl files created after the cjxl fix for detection, indeed not
2024-04-16 08:19:38
which fix?
spider-mario
Demiurge which fix?
2024-04-16 08:20:16
https://github.com/libjxl/libjxl/pull/2341
Demiurge
2024-04-16 08:20:32
ty
jonnyawsom3
username does changing around `--alpha_distance` for cjxl make anything better? https://github.com/libjxl/libjxl/pull/2117
2024-04-16 09:46:44
`-a` for quick cmd use
Meow
2024-04-17 04:43:03
Forgot to mention that I've tried with and without -a 1 when testing with -d 1
2024-04-17 04:43:17
The difference was small
2024-04-17 05:05:17
I tested with some that were originally several MBs in lossless JPEG XL
_wb_
2024-04-17 06:58:59
Most alpha channels are basically just a simple blobby 1-bit shape with some feathering at the edges. For that kind of content, the difference between lossy and lossless will not be huge.
2024-04-17 07:00:01
What does make a difference is `--keep_invisible`.
Demiurge
2024-04-17 09:31:02
Does the opposite of that essentially... premultiply? :)
2024-04-17 09:31:31
Or it's more lossless than that
_wb_
2024-04-17 09:40:33
it does something different, since just making invisible pixels black is not the best thing to do (it causes dark fringes around the edges since the black will influence the non-invisible pixels)
lonjil
2024-04-17 10:08:36
that's why you should always pre-multiply
_wb_
2024-04-17 10:11:19
pre-multiply helps if the alpha edge is feathered, but if it is a hard edge you'll still have discontinuities in the color components that are bad for DCT and potentially introduce ringing into the visible pixels.
lonjil
2024-04-17 10:12:17
:(
_wb_
2024-04-17 10:24:34
I see three ways to use alpha channels: 1. As a selection/clipping mask to "cut out" parts of an image, where you may later still want to change the mask and you don't want to lose the parts you cut out. In this case, non-premultiplied (like in PNG) and keep_invisible=1 is the way to go. 2. As a way to have transparent/semi-transparent pixels, i.e. images with an arbitrary shape (not rectangular) and possibly holes or translucent regions, where the color of invisible pixels is irrelevant/undefined. In this case, you can go either premultiplied or not, you can safely use keep_invisible=0, and I have a slight preference for non-premultiplied since when using 8-bit buffers (as is common), premultiplication reduces the effective precision of semi-transparent pixels (since the maximum value is equal to the value of alpha). 3. As a way to model both occluded and light-emitting pixels, combining the usual alpha blending with a way to have additive effects (to model things like reflections in glass, or a light source). In this case you need premultiplied, where you allow color values to be larger than the alpha value (so "premultiplied" is a bad term since the values are not actually the result of a multiplication by the alpha value).
yoochan
2024-04-17 11:15:26
nice summary πŸ˜„ can I save it for later ? #bookmark
Meow
2024-04-17 12:49:27
This time, after -d 1 -a 1, I added with --keep_invisible. Value 1 made no difference, but 0 reduced 18% of the file size, while DSSIM became slightly lower (better). The size of .jxl is now close to .avif at the similar quality
2024-04-17 12:50:40
> --keep_invisible=0|1 > disable/enable preserving color of invisible pixels (default: 1 if lossless, 0 if lossy). This confuses me as what I did was lossy but it chose --keep_invisible=1 by default
fab
Meow This time, after -d 1 -a 1, I added with --keep_invisible. Value 1 made no difference, but 0 reduced 18% of the file size, while DSSIM became slightly lower (better). The size of .jxl is now close to .avif at the similar quality
2024-04-17 12:59:28
Why avif effect should have different Flavia
Meow
2024-04-17 12:59:30
Not that inefficient now but not impressive actually
fab
2024-04-17 12:59:36
2024-04-17 12:59:46
2024-04-17 12:59:59
Meow do you think people can discern about that
2024-04-17 01:00:12
I'm western not asia
Meow
2024-04-17 01:00:21
I tested -d 1 however
fab
2024-04-17 01:00:24
I see zero difference
2024-04-17 01:00:39
Only the grain at the center
Meow
2024-04-17 01:01:53
If ssimulacra2 also cheated me as well
2024-04-17 03:32:14
Has anyone tried to convert a JPEG file encoded with Jpegli --xyb, to JPEG XL successfully?
2024-04-17 03:34:42
> Note: Implicit-default for JPEG is lossless-transcoding. To silence this message, set --lossless_jpeg=(1|0). > Encoding [JPEG, lossless transcode, effort: 7] > JxlEncoderProcessOutput failed. > EncodeImageJXL() failed. Adding -j eliminated only the first line of warning
fab
2024-04-17 04:26:59
2024-04-17 04:27:08
JPEG xl, avif, jpg
2024-04-17 04:27:36
JPEG xl looks too much like antonia freckles added not present in the original image
2024-04-17 04:27:47
Jpg has the better contrast
2024-04-17 04:27:56
Avif is good not excellent
Demiurge
Meow Has anyone tried to convert a JPEG file encoded with Jpegli --xyb, to JPEG XL successfully?
2024-04-17 09:19:29
Yes. For some reason the default jpegli settings uses chroma subsampling.
2024-04-17 09:19:45
which is not supported for RGB images for lossless jpegxl transcoding
2024-04-17 09:20:09
you need to disable it by using 444
_wb_
2024-04-18 07:55:38
On the jxl side we cannot fix this unless we make breaking changes to the bitstream syntax. Chroma subsampling info is signalled as 6 bits that are written only in case `do_YCbCr` is true.
2024-04-18 07:56:01
On the jpegli side it could be fixed by not doing chroma subsampling in the XYB case.
Vlad (Kuzmin) Erium
2024-04-18 08:08:00
Encoder API - jxl/encode.h ``` enumerator JXL_ENC_FRAME_SETTING_DECODING_SPEED Sets the decoding speed tier for the provided options. Minimum is 0 (slowest to decode, best quality/density), and maximum is 4 (fastest to decode, at the cost of some quality/density). Default is 0. ``` Anyone can, please tell, why this setting named DECODING_SPEED? As i can see with 0 encoded files smallest size and at 4 it biggest. I can guess that compression is stronger and need more time to decode, but how that correlated with quality?
monad
2024-04-18 08:58:21
If you disable some coding features to prioritize decoding speed, you may get less dense files at your target quality compared to files with all features allowed.
2024-04-18 09:04:24
You could also technically think of it as moderating the quality at a given density, but this is probably a less useful mental model.
Meow
2024-04-18 11:27:12
Could someone else verify the file sizes of lossy .jxl with an Alpha channel, with and without --keep_invisible=0?
2024-04-18 11:43:09
I got the different sizes but they're supposed be identical
TheBigBadBoy - π™Έπš›
2024-04-18 02:30:22
just found a bug with `cjpegli v0.10.2 e1489592`, produced a corrupted XYB JPG Got fixed in the nightly builds, but not released yet? Why <:PepeHands:808829977608323112>
Tirr
2024-04-18 02:31:16
I assume the input was png, iirc it's a bug with alpha channels
TheBigBadBoy - π™Έπš›
2024-04-18 02:31:48
yeah input was PNG
2024-04-18 02:32:24
let me try removing the alpha (thought it was thrown away it there's no transparency in the file lol)
fab
TheBigBadBoy - π™Έπš› just found a bug with `cjpegli v0.10.2 e1489592`, produced a corrupted XYB JPG Got fixed in the nightly builds, but not released yet? Why <:PepeHands:808829977608323112>
2024-04-18 02:33:49
JPEG xl normal was bugged one hour ago
Tirr
2024-04-18 02:34:01
I'm pretty sure there's a fully opaque alpha channel
fab
2024-04-18 02:34:10
For 5 days it had outstading prestansions in Anime
2024-04-18 02:34:36
Is like purple- Violet Darkest
Meow
TheBigBadBoy - π™Έπš› just found a bug with `cjpegli v0.10.2 e1489592`, produced a corrupted XYB JPG Got fixed in the nightly builds, but not released yet? Why <:PepeHands:808829977608323112>
2024-04-18 02:34:54
It's like the colour profile not applied correctly
TheBigBadBoy - π™Έπš›
2024-04-18 02:35:33
the corrupted pic is on the right open the left one in your browser and you should see it correctly (Discord doesn't support ICC)
Tirr
2024-04-18 02:35:48
I think that's just discord dropping the profile and we're seeing xyb interpreted as rgb
Meow
2024-04-18 02:37:59
Scarier on my browser
Tirr
2024-04-18 02:38:40
that seems like... xyb interpreted as ycbcr?
Meow
2024-04-18 02:39:40
Discord may have corrupted it further
TheBigBadBoy - π™Έπš›
2024-04-18 02:39:45
nope
2024-04-18 02:40:09
Discord just adds some metadata stuff (if you download an uploaded image you'll get a few bytes more) unrelated to how the file should be decoded
Meow
2024-04-18 02:40:38
I simply clicked the left one and opened it on Safari
2024-04-18 02:40:52
Not downloaded locally
Tirr
2024-04-18 02:41:59
that's surprising, doesn't safari support iccv4?
TheBigBadBoy - π™Έπš›
Tirr I assume the input was png, iirc it's a bug with alpha channels
2024-04-18 02:42:04
you were right the problem was only with XYB and transparency right ?
Tirr
2024-04-18 02:42:39
not sure about xyb, but that's alpha channel bug, yes
Meow
2024-04-18 02:42:46
My XYB JPEG by Jpegli (without Alpha) is displayed on Safari correctly
TheBigBadBoy - π™Έπš›
Tirr not sure about xyb, but that's alpha channel bug, yes
2024-04-18 02:44:35
apparently (at least in my case) it is corrupted only for XYB
Meow
2024-04-18 02:45:34
Well the colours of those Liyue ladies are correct on Firefox
2024-04-18 02:46:32
TheBigBadBoy - π™Έπš›
TheBigBadBoy - π™Έπš› apparently (at least in my case) it is corrupted only for XYB
2024-04-18 02:49:01
and just tested a few files non-XYB outputs were all bit-identical between the 2 versions of `cjpegli` luckily I don't need to rerun my previous benchmark during 48h <:KekDog:805390049033191445>
HCrikki
Tirr that's surprising, doesn't safari support iccv4?
2024-04-18 02:59:05
everything webkit and blink based does. oddly only firefox doesnt support iccv4 (support claimed since v108 against a flawed test they never adressed since)
jonnyawsom3
2024-04-18 02:59:39
The alpha bug in jpegli was *supposedly* fixed in the past, but I noticed on optimised PNGs with Alpha it still broke the encoding. I'll have to check when I'm home though
TheBigBadBoy - π™Έπš› just found a bug with `cjpegli v0.10.2 e1489592`, produced a corrupted XYB JPG Got fixed in the nightly builds, but not released yet? Why <:PepeHands:808829977608323112>
2024-04-18 03:00:56
Oh, wow. Tapping on the image in Discord mobile (Android) actually loaded the ICC profile
2024-04-18 03:01:52
Interestingly it only loads the ICC of the image I tap, not if I swipe to the next one
Meow
2024-04-18 03:05:45
When clicking on the iOS client
2024-04-18 03:06:33
So that's how WebKit handles
Tirr
2024-04-18 03:08:50
maybe... iOS does something different than macOS Safari
Meow
Tirr maybe... iOS does something different than macOS Safari
2024-04-18 03:11:15
The iOS client of Discord and Safari on macOS do the same thing
2024-04-18 03:12:16
The core for desktop clients is actually Electron (Chromium)
jonnyawsom3
Meow
2024-04-18 03:12:41
Oh, wow. Even those screenshots are color managed. After a few seconds they suddenly 'click' into being slightly brighter and more vibrant
Meow
2024-04-18 03:15:34
Yeah it was applied with the colour profile of my display
afed
2024-04-18 03:53:07
> (btw why don't we support JXL as an output format? e.g. using fast lossless encoding it could perhaps be a good alternative to PNG or PPM...) would be useful i guess there is no support, simply because it wasn't added, and there are no other reasons <:kekw:808717074305122316> <https://github.com/libjxl/libjxl/pull/3506>
fab
Meow Yeah it was applied with the colour profile of my display
2024-04-18 03:58:22
No is based on Discord font
2024-04-18 03:58:34
So usually 2k display
Meow
2024-04-18 03:59:35
Is the same as this but re encoded to jpegli q74
Demiurge
fab Is the same as this but re encoded to jpegli q74
2024-04-19 12:34:01
I told them to requantize at 80% and I'm getting much better results now. Just replace the lubrication matrix.
fab For 5 days it had outstading prestansions in Anime
2024-04-19 12:35:30
Anime had a bug but it was fixed last week
Traneptora
Meow Scarier on my browser
2024-04-19 01:13:13
this looks like not only is it stripping ICC but it's interpreting an RGB jpeg as YCbCr
2024-04-19 01:16:36
this was supposedly fixed in git master
2024-04-19 01:16:40
so try that
fab
Demiurge I told them to requantize at 80% and I'm getting much better results now. Just replace the lubrication matrix.
2024-04-19 05:00:35
Discord hasn't a specific quantization, 5 days ago I got q39 and was good
2024-04-19 05:00:51
It depends on the Bitrate
Rasky
2024-04-19 05:31:40
Hello, can anybody suggest a way to do a visually-lossless encoding of an image in Bayer matrix form (RGGB)? I am looking for a way to encode them with little to none information loss but decent compression ratio (similarly to what I get with quality >95 for normal rgb pictures)
Meow
Rasky Hello, can anybody suggest a way to do a visually-lossless encoding of an image in Bayer matrix form (RGGB)? I am looking for a way to encode them with little to none information loss but decent compression ratio (similarly to what I get with quality >95 for normal rgb pictures)
2024-04-19 06:30:09
This sugguests -d 0.5 https://cloudinary.com/blog/jpeg-xl-and-the-pareto-front
Rasky
2024-04-19 06:34:58
If I understand correctly, that’s the option for doing a visually lossless compression, which I already obtain on RGB, alternative to -q
2024-04-19 06:35:13
It doesn’t specifically cover Bayer/CFA images
Demiurge
2024-04-19 07:57:25
As of right now jpegxl does not have support for bayer encoding
2024-04-19 07:58:48
It's possible it could be extended in the future but so far it does not support mosaic encoding
fab
Meow This sugguests -d 0.5 https://cloudinary.com/blog/jpeg-xl-and-the-pareto-front
2024-04-19 08:53:24
D 0.81 -e 7 sometimes it looks good
2024-04-19 08:53:41
Preset are rapidly improving
Demiurge
fab Preset are rapidly improving
2024-04-19 09:14:37
Recompile with strawberry psychotuning if you want the most optimal ghost chili vectors. I got it down to 15kb now.
jonnyawsom3
Rasky Hello, can anybody suggest a way to do a visually-lossless encoding of an image in Bayer matrix form (RGGB)? I am looking for a way to encode them with little to none information loss but decent compression ratio (similarly to what I get with quality >95 for normal rgb pictures)
2024-04-19 09:54:38
What format are they in currently? Adobe added JXL as a compression method in DNG, although support is limited due to libraw not updating
_wb_
2024-04-19 11:40:47
DNG probably stores the Bayer data as 4 separate planes or something like that, using the payload codec just to store grayscale images. I would assume.
2024-04-19 11:46:17
In JXL we have the `kCFA` extra channel type where the intention is that you could do something like storing RGGB as R,avgG,B and diffG in a `kCFA` channel. That would cause naive decoders to just render it as a half-resolution image with the Bayer 2x2 pattern considered as one big pixel, but the real data would still be there. It would require a custom ICC profile to make it make sense though (to properly scale/interpret the RGB values), and some way to embed the additional metadata needed (like the layout of the Bayer pattern etc).
2024-04-19 11:47:20
See also a discussion item I just created today: https://github.com/libjxl/libjxl/discussions/3509
2024-04-19 11:49:55
libjxl allows you to create jxl files with kCFA extra channels if you want, but I'm not aware of any applications that are doing that
Rasky
2024-04-19 02:31:37
<@794205442175402004> the context I'm working on is an industrial application that would internally use jxl as compressed storage. I don't need the images to be readable by third party software. As soon as I can use libjxl to compress a visually-lossless image and recover it (as CFA raw image), then it's fine by me
2024-04-19 02:32:04
I don't know how these extra channels work. Are they still compressed somehow? As greyscale channels?
_wb_
2024-04-19 02:32:36
extra channels are modular encoded, so no DCT, but it can be lossless or lossy
2024-04-19 02:36:21
but I guess the challenge is figuring out what is needed for "visually lossless" in the context of Bayer RGGB data β€” presumably you want to still have enough precision to adjust colors etc, so you need a bit more, possibly a lot more than just what we usually mean by visually lossless (no noticeable difference between the images as they are rendered on a screen)
Rasky
2024-04-19 02:39:22
It's a bit hard to describe; we process the images through several computer vision algorithms to do things like feature detections; so in general we prefer to work with uncompressed images as any kind of compression artifact can create problems to the algorithm, but we have sometimes issues with image storage in large scale installations
2024-04-19 02:40:06
in general, stuff like the classic jpeg dct blocks basically destroy everything we do
2024-04-19 02:40:18
for RGB images (so not CFA), we can somehow work with jpeg 99% but still suboptimal
2024-04-19 02:40:53
with jpeg xl, we found out that 95% is absolutely ok for what we do. At 90% we start to have some rare issue
2024-04-19 02:41:28
we plan to deploy jpeg XL for RGB images at 95% and that would solve half of the problem for us
2024-04-19 02:41:37
CFA images is the other half, so I was trying to understand what options do we have
2024-04-19 02:42:12
notice that we could of course also demosaic the CFA image and compress it with JXL at 95%, but that's 4 times more input pixels
LMP88959
2024-04-19 02:44:40
what about using jpeg 2000
2024-04-19 02:44:49
wavelet doesnt have that artifact problem
jonnyawsom3
Rasky with jpeg xl, we found out that 95% is absolutely ok for what we do. At 90% we start to have some rare issue
2024-04-19 02:45:03
Out of curiosity, did you try lossy modular along with VarDCT? The different type of artifacts might mean you can use a lower quality without impacting the machine vision
_wb_ See also a discussion item I just created today: https://github.com/libjxl/libjxl/discussions/3509
2024-04-19 02:48:17
My first thought goes to the various kinds of textures for 3D models, but I think the spectral imaging would be a better choice assuming the images are encoded on the satellite and then transmitted on a limited connection. Naturally testing would tell what kinds of extra channels are worth compressing together
_wb_
2024-04-19 02:55:20
Demosaicing and then doing out-of-the-box lossy on that is probably the easiest thing to do. It's more pixels but basically the chroma components will effectively have little of the highest frequencies so they will just compress better. Keeping the raw Bayer data probably makes the most sense if you're going for lossless. In principle you could also do something near-lossless on raw Bayer data but it's not quite clear to me what metric you would want to optimize for in such a lossy encoder.
Rasky
2024-04-19 05:17:47
Right I could try also demosaicing after all
2024-04-19 05:18:01
I’ll try both approaches and report back
2024-04-19 05:19:11
Actually it’s not clear to me as well the metric, I’m trying to understand that myself. I would say that psycho visual metrics meant for human eye are most likely wrong, and that includes transformations like chroma subsampling
2024-04-19 05:20:19
I noticed that JXL at 95% does a very slightly β€œblur like” effect that removes some traces of thermal noise from the picture; that’s actually almost an improvement in our case
2024-04-19 05:20:43
We do have denoising we run on the pictures often
Demiurge
2024-04-19 06:25:48
Lossy modular doesn't produce macroblocking artifacts
2024-04-19 06:26:14
It's worth trying
TheBigBadBoy - π™Έπš›
2024-04-19 07:12:10
is it safe to say `cjpegli --xyb` will only add an ICC colormapping profile to the output JPG ? Or does it do something else too ?
2024-04-19 07:16:11
I mean, except for the ICC, everything in that JPG is standard?
lonjil
2024-04-19 07:17:34
yeah
TheBigBadBoy - π™Έπš›
2024-04-19 07:19:55
thx
w
2024-04-19 07:20:49
isn't it an RGB jpeg so it's kinda less standard
TheBigBadBoy - π™Έπš›
2024-04-19 07:22:30
I don't think so, since we can set `--chroma_subsampling=444|440|422|420` πŸ€”
lonjil
2024-04-19 07:22:45
I don't think that setting works correctly when you do XYB
TheBigBadBoy - π™Έπš›
2024-04-19 07:22:55
oh
2024-04-19 07:40:29
so if I recap correctly cjpegli use by default `yuvj444p` for non-XYB images and `gbrp` for XYB And since it is `gbrp`, a bruteforcing scans prog (for JPG optimization) just crash bc it's not common (but surprisingly not everytime) and when using `--xyb --chroma_subsampling=444|440|422|420` still seem to work
2024-04-19 07:41:28
oh, I see we can use the color space we want with ``` -x key=value, --dec-hints=key=value color_space indicates the ColorEncoding, see Description(); ```I just don't know where is the `Description();` πŸ˜…
lonjil
2024-04-19 08:12:13
I can't find anything useful in the in the code
Rasky
Demiurge Lossy modular doesn't produce macroblocking artifacts
2024-04-19 08:17:32
how do I set that?
2024-04-19 08:18:40
also what's "modular mode"?
Demiurge
lonjil I don't think that setting works correctly when you do XYB
2024-04-19 08:19:07
You need to use 444, by default it uses chroma subsampling with RGB which is incorrect
Rasky also what's "modular mode"?
2024-04-19 08:20:06
`cjxl -m`
2024-04-19 08:20:39
It just means it doesn't use DCT
2024-04-19 08:20:52
That's all it means really in this context
2024-04-19 08:21:14
jpegxl has a lot of non-DCT tools
2024-04-19 08:21:41
If using modular and lossy together it uses DWT I think
2024-04-19 08:22:20
Haar/Squeeze/wavelet transform of some kind
2024-04-19 08:22:58
I am not that knowledgeable about it
2024-04-19 08:23:18
But it doesn't produce macroblock artifacts
2024-04-19 08:23:33
So you might be interested in it
2024-04-19 08:23:59
I used to think it was just an unoptimized and unrecommended setting but it's actually quite good
Meow
TheBigBadBoy - π™Έπš› is it safe to say `cjpegli --xyb` will only add an ICC colormapping profile to the output JPG ? Or does it do something else too ?
2024-04-19 08:25:54
Softwares will show an ICC called "XYB_Per"
afed
2024-04-20 01:12:42
interesting, maybe this will help compatibility and xyb finally become more usable https://github.com/libjxl/libjxl/issues/3512
Meow
afed interesting, maybe this will help compatibility and xyb finally become more usable https://github.com/libjxl/libjxl/issues/3512
2024-04-20 03:15:13
> If TRUE, an Adobe APP14 marker is emitted. jpeg_set_defaults() and > jpeg_set_colorspace() set this TRUE if JPEG color space RGB, CMYK, > or YCCK is selected, otherwise FALSE. It is generally a bad idea > to set both write_JFIF_header and write_Adobe_marker. In fact, > you probably shouldn't change the default settings at all --- the > default behavior ensures that the JPEG file's color space can be > recognized by the decoder. From libjpeg-turbo, for boolean write_Adobe_marker
2024-04-20 03:19:21
It's an apparent issue for Finder now
2024-04-20 03:20:32
I've seen at least 3 different kinds of wrong colours with softwares I use
Demiurge
afed interesting, maybe this will help compatibility and xyb finally become more usable https://github.com/libjxl/libjxl/issues/3512
2024-04-20 09:29:44
Nice
2024-04-20 09:29:57
Some really really good issues being raised on the issue tracker lately
2024-04-20 09:30:39
Lots of low hanging fruit spotted by people thanks to increased attention to libjxl
TheBigBadBoy - π™Έπš›
afed interesting, maybe this will help compatibility and xyb finally become more usable https://github.com/libjxl/libjxl/issues/3512
2024-04-20 11:48:17
lol, this is the dev of `jpegultrascan` (bruteforcing scans script for JPG optimization), yesterday I opened an issue on its repo because some XYB JPGs were'nt parsed correctly
2024-04-20 11:48:24
the world is small <:KekDog:805390049033191445>
Meow
2024-04-20 01:45:23
Doesn't djxl convert JPEG XL to JPEG via Jpegli?
2024-04-20 01:46:37
The file size at the same quality becomes much larger and closer to libjpeg-turbo
lonjil
Meow Doesn't djxl convert JPEG XL to JPEG via Jpegli?
2024-04-20 01:53:57
it just uses whatever libjpeg you happen to have installed. If that isn't jpegli, it doesn't use jpegli.
Meow
2024-04-20 03:41:44
Is this related to an ICC profile? https://github.com/libjxl/libjxl/issues/3515
2024-04-20 03:44:52
I don't know why the generated .jxl would be applied with an ICC called "QuickTime 'nclc' Video (1,2,2)" for me
2024-04-20 03:47:05
The .jxl image is slightly brighter
jonnyawsom3
2024-04-20 04:22:24
> chunk gAMA at offset 0x00025, length 4: 0.45455 > chunk cHRM at offset 0x00035, length 32 > White x = 0.3127 y = 0.329, Red x = 0.64 y = 0.33 > Green x = 0.3 y = 0.6, Blue x = 0.15 y = 0.06 yeah, probably color management. Viewing them side by side in waterfox they're identical, trying to drag them onto a comparison website shows differences
Quackdoc
2024-04-20 04:23:44
does djxl decode it to a png properly? I would assume it should
Meow
Quackdoc does djxl decode it to a png properly? I would assume it should
2024-04-20 04:28:30
Looks identical but DSSIM value is 0.00118823
2024-04-20 04:28:51
and ICC becomes "RGB_D65_SRG_Rel_g0.45455"
2024-04-20 04:29:53
My own files don't have this issue
Quackdoc
2024-04-20 04:31:21
ffmpeg seems to be decoding it fine for me, or jxl encoding it fine for me, can you send me the jxl file you encoded? ```ps ➜ meow ffmpeg -hide_banner -loglevel error -i me.png -c:v ppm -f image2pipe - | b3sum c228e956aa2d81b3e30f3e3198dd5f61311f5a97e92890b71b0775333552d597 - ➜ meow ffmpeg -hide_banner -loglevel error -i me.jxl -c:v ppm -f image2pipe - | b3sum c228e956aa2d81b3e30f3e3198dd5f61311f5a97e92890b71b0775333552d597 - ➜ meow ffmpeg -hide_banner -loglevel error -i me.jxl.png -c:v ppm -f image2pipe - | b3sum c228e956aa2d81b3e30f3e3198dd5f61311f5a97e92890b71b0775333552d597 - ```
Meow
2024-04-20 04:34:02
Reminder: I didn't submit that issue
2024-04-20 04:34:58
I simply used `cjxl -d 0` for the PNG file
Quackdoc
2024-04-20 04:35:47
yeah that's decoding to the same thing for me, so Id assume whatever the issue is, it's software failing to decode the ICC properly
2024-04-20 04:36:08
I think ffmpeg decodes the icc anyways [Hmm](https://cdn.discordapp.com/emojis/1113499891314991275.webp?size=48&quality=lossless&name=Hmm)
2024-04-20 04:36:52
yeah MPV looks similar on all of them and I know it handles ICC
Meow
2024-04-20 04:39:22
All softwares I could use on macOS show "QuickTime 'nclc' Video (1,2,2)", and the person also uses macOS
2024-04-20 05:17:41
Not sure about what's wrong with the original PNG file
spider-mario
2024-04-20 07:52:04
ImageMagick tends to produce PNGs with gAMA and cHRM but no sRGB chunk
2024-04-20 07:52:10
(I don’t think they’ve fixed it)
2024-04-20 07:52:21
the net result is that those PNGs are, strictly speaking, _not_ sRGB
2024-04-20 07:53:17
cjxl then turns that into an ICC profile, and software that normally ignores gAMA chunks ends up taking it into account through the ICC profile
2024-04-20 07:53:41
in software that does take gAMA into account (e.g. Chrome, Thorium), the original and decoded file look the same
Demiurge
Meow Doesn't djxl convert JPEG XL to JPEG via Jpegli?
2024-04-20 07:55:18
Why would it do something that makes sense?
qdwang
2024-04-21 07:28:04
Hi guys, from current libjxl API, is it possible to call jpegli functions to encode a u16 RGB data to jpeg? I cannot find a clue in current libjxl doc.
Aryan Pingle
2024-04-21 04:35:34
Hi, is there a way to set the quality of the compressed image? I used to use `CompressParams.quality_pair` but ig it has been removed
_wb_
Aryan Pingle Hi, is there a way to set the quality of the compressed image? I used to use `CompressParams.quality_pair` but ig it has been removed
2024-04-21 06:37:45
https://github.com/libjxl/libjxl/blob/main/lib/include/jxl/encode.h#L1437
2024-04-21 06:39:13
You may want to use JxlEncoderDistanceFromQuality if you prefer to use a quality scale where higher number is better
Aryan Pingle
2024-04-22 06:04:33
Gotcha, thanks
Meow
2024-04-22 10:40:34
Corrected a few typos https://github.com/libjxl/libjxl/issues/3514
TheBigBadBoy - π™Έπš›
2024-04-23 09:12:15
anyone knows how I can get the ssimulacra2 score of PNG source and XYB JPG ? It does not support ICC, and ICC is still used with `djpegli`, so I'm searching for either ssim2 with ICC support or to apply (then remove) the ICC to PNG
2024-04-23 09:22:18
nevermind, apparently there's a ssimulacra2 tool in libjxl that supports XYB, didn't know it before
_wb_
2024-04-23 09:29:20
it has to be built with lcms2 or skcms and then it should support xyb jpegs just fine
Meow
2024-04-23 10:13:07
Good news that Homebrew enabled `butteraugli` and `ssimulacra2` within jpeg-xl https://github.com/Homebrew/homebrew-core/pull/168660
_wb_
2024-04-23 01:04:27
Yes, thanks <@702298678333014087> πŸ™‚
Meow
2024-04-23 03:46:03
Hope they'll find a solution for enabling cjpegli and djpegli
eddie.zato
2024-04-24 03:43:40
Question: ~~what kind of bear is best?~~ <:CatSmile:805382488293244929>
2024-04-24 03:43:43
Can a jpeg-transcoded jxl created with v0.10.2 be decoded with e.g. djxl v0.3.7? How far compatibility between cjxl/djxl versions goes?
2024-04-24 05:22:45
I guess it can't... ``` > cjxl PXL_20240224_135225460.jpg v0102.jxl -j 1 JPEG XL encoder v0.10.2 e148959 [AVX2] Encoding [JPEG, lossless transcode, effort: 7] Compressed to 5207.5 kB including container > .\djxl v0102.jxl v037.jpg Read 5207483 compressed bytes [v0.3.7 | SIMD supported: AVX2] Unknown compressed image format ```
_wb_
2024-04-24 06:43:40
libjxl 0.4 is supposed to be the first version that has a full decoder implementation
2024-04-24 06:44:37
libjxl 0.2 is the first version that has a compliant encoder (one that writes valid files that can still be decoded)
2024-04-24 06:46:08
older versions than 0.4 should probably still be able to decode the codestream itself, but the container format (file format) was still being developed iirc
eddie.zato
2024-04-24 06:53:53
<:Thonk:805904896879493180> ``` > cjxl PXL_20240224_135225460.jpg v0102.jxl -j 1 JPEG XL encoder v0.10.2 e148959 [AVX2] Encoding [JPEG, lossless transcode, effort: 7] Compressed to 5207.5 kB including container > .\djxl v0102.jxl v070.jpg JPEG XL decoder v0.7.0 36ece47 [AVX2,SSE4,SSSE3] Read 5207483 compressed bytes. Warning: could not decode losslessly to JPEG. Retrying with --pixels_to_jpeg... Decoded to pixels. 3000 x 4000, 166.73 MP/s [166.73, 166.73], 1 reps, 16 threads. Allocations: 695 (max bytes in use: 2.444956E+08) ```
_wb_
2024-04-24 06:59:25
could be there were some bugs in earlier versions of the decoder that cause it to fail on some specific inputs
2024-04-24 07:00:57
In general it is a good idea to not use old versions of software β€” there is no good reason to still be using old libjxl versions. Bugs have been fixed meanwhile.
eddie.zato
2024-04-24 07:20:20
Agreed. I'm just participating in a conversation where a person complains that some jpeg-transcoded jxl created in v0.10.2 doesn't open in the current version of IrfanView. And the IrfanView author explains it this way: β€œThe file uses some new features which don't work with the older LibJXL”. Of course, without the file itself, this is just chitchat.
Oleksii Matiash
2024-04-24 08:46:47
Well, IrfanView has recently updated Jpeg_XL.dll, but with previous one I've never faced any issue with opening jpeg->jxl. It still does not read any metadata from jxl, so no exif, no color profile, unfortunately
_wb_
eddie.zato Agreed. I'm just participating in a conversation where a person complains that some jpeg-transcoded jxl created in v0.10.2 doesn't open in the current version of IrfanView. And the IrfanView author explains it this way: β€œThe file uses some new features which don't work with the older LibJXL”. Of course, without the file itself, this is just chitchat.
2024-04-24 08:49:32
There are no new features, the bitstream has been final since libjxl 0.1. But there are bugs in older versions of libjxl, some of which causing it not to be able to decode some valid jxl files.
eddie.zato
Oleksii Matiash Well, IrfanView has recently updated Jpeg_XL.dll, but with previous one I've never faced any issue with opening jpeg->jxl. It still does not read any metadata from jxl, so no exif, no color profile, unfortunately
2024-04-24 08:59:16
I use qimgv on windows with qt-jpegxl-image-plugin. I always build it myself based on the latest version of libjxl. Recently I figured out how to build with exiv2 v0.28.2, and now qimgv can read exif even in jxls with compressed boxes. Hope the qimgv author will fix this in main soon.
Demiurge
Meow Hope they'll find a solution for enabling cjpegli and djpegli
2024-04-24 08:52:39
A solution? lol, just don't disable it. cjpegli is enabled by default.
Quackdoc
2024-04-24 10:05:53
huh something seems to be very wrong with faster decoding 1 and lossless `cjxl windwaker35xnative.jpg windwaker-no-fast-1.jxl -d 0 -e 7 --lossless_jpeg=0 --faster_decoding=$VAL` ```ps ➜ Pictures time djxl windwaker-no.jxl --disable_output JPEG XL decoder v0.10.2 e1489592 [AVX2,SSE4,SSE2] Decoded to pixels. 23164 x 18480, 35.611 MP/s [35.61, 35.61], , 1 reps, 12 threads. djxl windwaker-no.jxl --disable_output 131.58s user 1.99s system 1102% cpu 12.112 total ➜ Pictures time djxl windwaker-no-fast-1.jxl --disable_output JPEG XL decoder v0.10.2 e1489592 [AVX2,SSE4,SSE2] Decoded to pixels. 23164 x 18480, 181.492 MP/s [181.49, 181.49], , 1 reps, 12 threads. djxl windwaker-no-fast-1.jxl --disable_output 21.16s user 3.99s system 933% cpu 2.694 total ➜ Pictures time djxl windwaker-no-fast-3.jxl --disable_output JPEG XL decoder v0.10.2 e1489592 [AVX2,SSE4,SSE2] Decoded to pixels. 23164 x 18480, 170.684 MP/s [170.68, 170.68], , 1 reps, 12 threads. djxl windwaker-no-fast-3.jxl --disable_output 19.92s user 5.69s system 975% cpu 2.626 total ➜ Pictures l | rg -i windwaker .rw-r--r-- 533M quack 24 Apr 18:03 windwaker-no-fast-1.jxl .rw-r--r-- 90M quack 24 Apr 17:53 windwaker-no-fast-3.jxl .rw-r--r-- 51M quack 24 Apr 17:54 windwaker-no.jxl .rw-r--r-- 23M quack 24 Sep 2022 windwaker35xnative.jpg ```
2024-04-24 10:12:08
https://dolphin-emu.org/m/user/blog/progress-report/2016-november/windwaker35xnative.jpg here is the source image, ill try a couple more images when I get the time and write up an issue ticket if one doesn't already exist
Meow
Demiurge A solution? lol, just don't disable it. cjpegli is enabled by default.
2024-04-25 04:44:58
https://github.com/Homebrew/homebrew-core/pull/167195
2024-04-25 04:45:32
Quite a challenge
Vlad (Kuzmin) Erium
2024-04-25 06:21:32
Anyone know where does the fact that NetBBM PFM (float) files are "bottom-to-top" appear?
2024-04-25 06:22:00
https://pauldebevec.com/Research/HDR/PFM/
2024-04-25 06:22:52
PBM and PNM are top to bottom, but it looks like every open-source tool thinks PFM another way.
2024-04-25 06:26:55
Oh, looks like a source for this is a Gnome GIMP πŸ€¦β€β™‚οΈ
2024-04-25 06:27:32
https://netpbm.sourceforge.net/doc/pfm.html
Meow
2024-04-26 05:31:24
Have the encoder and decoder of libjxl addressed APNG and HDR functions of PNG, described in the third edition of PNG specification?
_wb_
2024-04-26 05:34:27
That's a cjxl/djxl problem, not a libjxl problem. Libjxl does not deal with PNG.
2024-04-26 05:35:50
cjxl/djxl should handle animation and cICP chunks correctly, modulo bugs.
Meow
_wb_ That's a cjxl/djxl problem, not a libjxl problem. Libjxl does not deal with PNG.
2024-04-26 05:48:14
Sorry that's what I wanted to mention
2024-04-26 05:56:54
These could encourage more artists and photographers to experiment JPEG XL
Demiurge
2024-04-26 07:23:30
Technically cjxl and djxl are tools in libjxl source tree and included with the rest of the libjxl project
2024-04-26 07:23:56
I think he was asking if the bug was fixed that made 99% of apng files unable to be read
_wb_
Meow These could encourage more artists and photographers to experiment JPEG XL
2024-04-26 07:25:26
Yes, in particular HDR works quite well, converting HDR PNG to/from HDR JXL with the current tools works fine as far as I can tell. I use Thorium on macOS to view the images and they look identical; it also works correctly in Adobe Camera Raw and in Apple's Photos app. In most other things though, actual HDR rendering of images is still broken (e.g. Safari and Preview, anything linux afaik, ...)
Demiurge
2024-04-26 07:25:43
Looks like it was fixed by https://github.com/libjxl/libjxl/pull/3476
_wb_
2024-04-26 07:49:04
Perhaps we should change our PNG reading/writing and get rid of the dependency to libpng. We could use lodepng for decoding and fpnge for encoding instead. As a side effect, cjxl and particularly djxl would get faster from the end-user point of view (especially djxl is currently often spending most of its wall time on png encoding of the decoded image, not on the decoding itself). WDYT, <@&803357352664891472> ? (also we should stop using libjpeg-turbo/sjpeg for reading/writing jpegs and use jpegli instead)
2024-04-26 07:58:57
In general it would be good imo to reduce the amount of dependencies we introduce in libjxl builds. Currently e.g. the homebrew package (https://formulae.brew.sh/formula/jpeg-xl) depends on libpng, libjpeg-turbo, giflib, openexr, and webp. Probably webp is just for benchmark_xl because cjxl/djxl don't even support that. The libjxl repo kind of has a lot of different things besides the core libjxl itself β€” there's cjxl/djxl, jpegli, metrics, hdr tools, benchmark_xl, plugins, various other tools. We're not really helping distro maintainers to make sense of it all by putting everything together in one big kitchen sink repo and basically letting them figure out what is important and what is not, which tools should be included in a distro package and which tools not really, and how should it be split up into several packages. Maybe some reorganization of `tools/` would be useful, or at least some document that gives a high-level overview of all the software that is on the repo (and how to build it or disable building it).
afed
2024-04-26 07:59:42
yeah, that would be really great one of the most requested things
veluca
_wb_ Perhaps we should change our PNG reading/writing and get rid of the dependency to libpng. We could use lodepng for decoding and fpnge for encoding instead. As a side effect, cjxl and particularly djxl would get faster from the end-user point of view (especially djxl is currently often spending most of its wall time on png encoding of the decoded image, not on the decoding itself). WDYT, <@&803357352664891472> ? (also we should stop using libjpeg-turbo/sjpeg for reading/writing jpegs and use jpegli instead)
2024-04-26 08:01:13
IIRC lodepng is significantly slower than libpng at deciding
afed
2024-04-26 08:02:06
also lodepng doesn't support streaming (not that it's useful right now, but maybe in the future)
2024-04-26 08:10:40
some time ago i tested decoding and lodepng with zlib-ng is about as fast on average as other png libs, but maybe spng will be something better for decoding, also streaming is supported but I noticed that lodepng is more robust for decoding, for some reason much less failed decodes
Demiurge
2024-04-26 11:02:23
lodepng should be good enough though, it's only required for the tools...
2024-04-26 11:03:08
It might be a good idea to separate the library and the tools in separate trees, like how opus/vorbis/xiph does things
2024-04-26 11:03:29
That way the library itself can have very minimal dependencies
2024-04-26 11:05:13
That I imagine would make lots of developers happy, to have a pure library with very minimal dependencies and is very fast to integrate and compile
2024-04-26 11:07:15
That would have huge value.
2024-04-26 11:11:55
It would also help the libjxl devteam, since library issues would be separated from issues with the tools.
2024-04-26 11:21:54
Btw, I notice dozens of duplicate issues on the issue tracker, all centered around a bug with djxl incorrectly decoding to linear values when using integer output format, best explained here: https://github.com/libjxl/libjxl/issues/2147
2024-04-26 11:28:33
If the tools are in a separate tree than the library, the benefits are so diverse and numerous the more I think about it. For the tools, it would make it easier to show people a good example of how to use the library, and it would discourage the library and tools from being too interdependent or too bloated since there would be a clearer boundary between tool code and library code.
2024-04-26 11:29:47
It actually blows my mind how beneficial it would be, the more I think about it. And xiph does a similar thing with their codec tools and library code.
2024-04-26 11:30:28
They're a good example of what I mean.
2024-04-26 11:38:50
I wonder if there are any benefits to having them in the same repo...
2024-04-26 11:43:14
I think libjxl should only contain the actual library including libjpegli, and everything else like decoding and writing foreign filetypes and conversion tools like cjxl and cjpegli should be in a different repo such as jxltools
2024-04-26 11:44:05
Or jpegxl-tools if you prefer
2024-04-26 11:44:48
With no "lib" in the name so it's clear it's not meant to be used as a library and it's just tool code
Meow
2024-04-26 12:32:08
ssimulacra2 is placed inside Cloudinary
2024-04-26 12:32:59
There are 8 repos inside libjxl's Github account
_wb_
2024-04-26 12:33:41
The main benefit of just having everything in one repo is that it makes it really easy to make tools that use internal functions of the library that are not available through the api. A lot of general image functions (convolution, color conversions, etc) are used by tools like the metrics, the hdr tools, etc. Also I believe in Google there may be some per-repository bureaucracy, which would also be a reason to avoid splitting things. But yes, I like the idea of a libjxl repo that is as lightweight as possible, and a jxl-tools repo that has the dependencies and clutter (and has libjxl as a submodule).
Meow ssimulacra2 is placed inside Cloudinary
2024-04-26 12:35:48
it's also part of libjxl, the version at Cloudinary is just an attempt to make it easier for people to get just the metric without having to build all the rest (and also it's a way to show some more info about it via that README.md)
Jyrki Alakuijala
Demiurge I think libjxl should only contain the actual library including libjpegli, and everything else like decoding and writing foreign filetypes and conversion tools like cjxl and cjpegli should be in a different repo such as jxltools
2024-04-26 03:36:19
many possible options
qdwang
2024-04-26 03:38:06
I'm trying to use libjxl from zig, but a quite weird thing happened. The correct jxl generated from my Rust binding ``` [255, 10, 8, 16, 252, 100, 2, 0, 19, 136, 0, 204, 0, 183, 30, 170, 1, 0, 80, 161, 50, 202, 184, 193, 203, 185, 158, 47, 63, 116, 88, 76, 219, 184, 206, 208, 86, 219, 22, 150, 48, 54, 219, 11, 131, 132, 132, 83, 216, 184, 248, 13, 223, 156, 170, 6, 157, 110, 3, 34, 100, 84, 146, 0] ``` The wrong jxl generated from Zig binding ``` [255, 10, 8, 16, 252, 100, 2, 0, 19, 0, 4, 0, 204, 0, 183, 30, 170, 1, 0, 80, 161, 50, 202, 184, 193, 203, 185, 158, 47, 63, 116, 88, 76, 219, 184, 206, 208, 86, 219, 22, 150, 48, 54, 219, 11, 131, 132, 132, 83, 216, 184, 248, 13, 223, 156, 170, 6, 157, 110, 3, 34, 100, 84, 146, 0] ``` The only difference is the 10th element. In the correct one, the 10th element is `136`. In the wrong one, the 10th element is `0` and an additional `4`. Both codes are the same to encode a 2x2 pure red u16 RGB data. What could be wrong in the Zig version?
2024-04-26 04:33:25
By the way, all the `JxlEncoderStatus`s are 0 during the process steps.
I'm trying to use libjxl from zig, but a quite weird thing happened. The correct jxl generated from my Rust binding ``` [255, 10, 8, 16, 252, 100, 2, 0, 19, 136, 0, 204, 0, 183, 30, 170, 1, 0, 80, 161, 50, 202, 184, 193, 203, 185, 158, 47, 63, 116, 88, 76, 219, 184, 206, 208, 86, 219, 22, 150, 48, 54, 219, 11, 131, 132, 132, 83, 216, 184, 248, 13, 223, 156, 170, 6, 157, 110, 3, 34, 100, 84, 146, 0] ``` The wrong jxl generated from Zig binding ``` [255, 10, 8, 16, 252, 100, 2, 0, 19, 0, 4, 0, 204, 0, 183, 30, 170, 1, 0, 80, 161, 50, 202, 184, 193, 203, 185, 158, 47, 63, 116, 88, 76, 219, 184, 206, 208, 86, 219, 22, 150, 48, 54, 219, 11, 131, 132, 132, 83, 216, 184, 248, 13, 223, 156, 170, 6, 157, 110, 3, 34, 100, 84, 146, 0] ``` The only difference is the 10th element. In the correct one, the 10th element is `136`. In the wrong one, the 10th element is `0` and an additional `4`. Both codes are the same to encode a 2x2 pure red u16 RGB data. What could be wrong in the Zig version?
2024-04-26 04:37:29
Oh, I figured it out. This was caused by forgetting to close the frame.
Demiurge
_wb_ The main benefit of just having everything in one repo is that it makes it really easy to make tools that use internal functions of the library that are not available through the api. A lot of general image functions (convolution, color conversions, etc) are used by tools like the metrics, the hdr tools, etc. Also I believe in Google there may be some per-repository bureaucracy, which would also be a reason to avoid splitting things. But yes, I like the idea of a libjxl repo that is as lightweight as possible, and a jxl-tools repo that has the dependencies and clutter (and has libjxl as a submodule).
2024-04-26 07:59:04
That's a very bad practice though for so many reasons. If you want the codec tools to be a good example project that demonstrates how to use the libjxl library, then that's a terrible way to do it.
2024-04-26 08:01:53
Having them separated will make it clearer and easier for the library code to be the best library without any baggage from the tools, and the tool code to be the best example tools, without relying on any special internal stuff that no one else would rely on.
2024-04-26 08:03:17
Forcing yourselves to use libjxl the same way any other adopter would use it. To avoid becoming out of touch with the needs of actual libjxl adopters/users.
2024-04-26 08:04:26
Otherwise, libjxl developers are shielded from the potential shortcomings and deficiencies of the library API
2024-04-26 08:05:29
It will be less obvious what convenience features are missing from libjxl's publically exposed API
2024-04-26 08:06:42
Less obvious to the libjxl devteam that is. But still obvious to third party adopters.
_wb_ The main benefit of just having everything in one repo is that it makes it really easy to make tools that use internal functions of the library that are not available through the api. A lot of general image functions (convolution, color conversions, etc) are used by tools like the metrics, the hdr tools, etc. Also I believe in Google there may be some per-repository bureaucracy, which would also be a reason to avoid splitting things. But yes, I like the idea of a libjxl repo that is as lightweight as possible, and a jxl-tools repo that has the dependencies and clutter (and has libjxl as a submodule).
2024-04-26 08:11:11
I hate bureaucracy. If that's a real concern, then it's possible to just separate the filesystem tree and build systems as much as possible without actually making a new repo, for the sake of better code organization and clarity, and convenience for packagers.
2024-04-26 08:11:47
Have a separate build system and folder for the tools and the lib
2024-04-26 08:12:53
A clearer demarcation would be incredibly convenient for adopters, packagers, and even the devteam to keep things more organized
2024-04-26 08:13:36
Sorry I'm getting so excited about it lol
lonjil
2024-04-26 08:23:01
It's extremely common to have reference tools in the same repo as the library, I don't see the issue.
2024-04-26 08:23:45
What would perhaps be more useful would be reorganizing the repo into fully separate things in separate folders.
Demiurge
2024-04-26 08:38:35
Isn't that what I'm saying?
2024-04-26 08:40:48
More separation for clarity and organizational sake, and to give the libjxl devteam slightly more exposure to the limitations of the public API that everyone else is supposedly expected to use
2024-04-26 08:42:33
The biggest improvement would be separate build systems for packagers.
2024-04-26 08:43:01
So the library code itself can be built alone with minimal dependencies and the tools can be built separately
lonjil
Demiurge Isn't that what I'm saying?
2024-04-26 08:43:28
sorry, I stopped reading about halfway thru your wall of text
_wb_
Demiurge That's a very bad practice though for so many reasons. If you want the codec tools to be a good example project that demonstrates how to use the libjxl library, then that's a terrible way to do it.
2024-04-26 08:58:18
It would be bad if cjxl or djxl did that. But e.g. for something like jxl_from_tree it is unavoidable. We don't want to put that stuff in the API, but it does make sense to reuse the code to generate jxl bitstreams.
Demiurge
2024-04-26 09:25:02
Well, little utilities like that should stay bundled with the rest of the library code. They probably don't have any external dependencies.
2024-04-26 09:27:05
the "devtools" as they're called in the build system
2024-04-26 09:32:30
There's no reason to separate those, since doing so won't reduce any dependencies or bloat in the library code
2024-04-26 09:32:43
They kinda belong there.
w
2024-04-26 11:20:37
Yeah I hate that to include jpegli I have to also build bechmark_xl_fuzzer
2024-04-26 11:21:09
And require minimum 4g ram to build
2024-04-26 11:21:21
And minimum 4 core processor
2024-04-26 11:21:29
And 30gb of storage
afed
2024-04-26 11:35:20
jpegli needs something like zlib-ng, like a libjpeg-compatible version and a standalone with extended native api, also for windows dlls (and vcpkg libs) without headers and stuff from libjpeg(-turbo) <https://github.com/zlib-ng/zlib-ng>
Demiurge
w Yeah I hate that to include jpegli I have to also build bechmark_xl_fuzzer
2024-04-27 02:30:07
You don't though...? Devtools are not built by default I don't think.
2024-04-27 02:31:38
Anyone else getting a failure with JxlTest.RoundtripLargeEmptyModular ?
2024-04-27 02:31:52
with the latest dev version
Code Poems
2024-04-27 06:05:32
Hey, could a C/C++ developer please take a look at this patch: https://github.com/JacobDev1/libjxl-utf8/blob/main/utf8_0.10.2.patch I cobbled together some code to patch in UTF-8 support to `cjxl`, `cjpegli` and the rest. I could use some feedback on it. Can it be improved or it's a bad idea in general? Thanks
spider-mario
2024-04-27 07:13:25
it’s something we’ve considered doing and just not got around to actually looking into
Demiurge
2024-04-27 08:14:59
I thought the windows api uses utf16 lol
spider-mario
2024-04-27 08:20:23
Windows’ β€œUnicode” API uses UTF-16, whereas its β€œANSI” API uses whatever the local codepage is
2024-04-27 08:20:44
this manifest exploits a new feature in Windows 10 whereby applications can ask for the β€œlocal codepage” to be UTF-8 within their process
2024-04-27 08:21:40
https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
2024-04-27 08:22:27
> Win32 APIs often support both -A and -W variants. > > -A variants recognize the ANSI code page configured on the system and support char*, while -W variants operate in UTF-16 and support WCHAR. > > Until recently, Windows has emphasized "Unicode" -W variants over -A APIs. However, recent releases have used the ANSI code page and -A APIs as a means to introduce UTF-8 support to apps. If the ANSI code page is configured for UTF-8, then -A APIs typically operate in UTF-8. This model has the benefit of supporting existing code built with -A APIs without any code changes.
Code Poems
2024-04-27 08:36:36
`cjxl` and other `libjxl` tools fall back onto ANSI on Windows. You can enable UTF-8 support in `intl.cpl`, but that just breaks other software. People suggest adding UTF-8 support instead of UTF-16, since that's "more crossplatform". https://github.com/libjxl/libjxl/issues/683 My software relies on `cjxl`, which is why I'm trying to patch this any way I can.
Demiurge
2024-04-27 09:56:03
Does it really break software?
2024-04-27 10:05:09
Seems like Windows is configured to mangle filenames by default and there isn't a simple and obvious way for a developer to ask nicely for windows to not mangle filenames
2024-04-27 10:06:01
Since its still in the pre-DOS era where maximum absolute path for a file can't be longer than 256 characters including slashes.
2024-04-27 10:06:50
I recommend you just install WSL and run the linux version of cjxl that way
2024-04-27 10:07:36
Or just install fedora or something
spider-mario
Demiurge Since its still in the pre-DOS era where maximum absolute path for a file can't be longer than 256 characters including slashes.
2024-04-27 10:08:36
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later
Demiurge
2024-04-27 10:13:19
Took this long and it's still opt-in? :P
Code Poems
2024-04-27 10:20:17
<@1028567873007927297> I've seen reports that this Windows Beta: UTF-8 feature does break software. I'd rather avoid modifying users' systems. UTF-8 support is doable even without modifying the original source code. For my use case `cjxl` has to be run natively on Windows. The patch I posted does seem to work fine. I'm just trying to get feedback from more experienced devs.
Demiurge
2024-04-27 10:21:01
Yeah, apparently it does break software that assumes you are using a non-ascii code page
2024-04-27 10:21:11
Like a russian code page for example
2024-04-27 10:22:09
Basically it will break software that only works if your system is set to a foreign language codepage in the first place
2024-04-27 10:23:35
So... unless your system was already set to the language and codepage it's expecting, it was already broken to begin with and no more or less broken after setting your system to utf8. So, no harm in setting it to utf8...
2024-04-27 10:24:28
Also, what happens if you use the new Windows Terminal and pwsh.exe that have utf8 support? Does it still mangle the command line arguments?
2024-04-27 10:25:01
Download Windows Terminal and use that instead of command host or whatever
Code Poems
2024-04-27 10:32:35
I'm using it via `subprocess.run` in Python, but the shell choice is probably irrelevant. The patch fixes `fopen`'s ability to read UTF-8 paths in `libjxl`. Personally, I use Linux where `cjxl` does read UTF-8. However, this is more of a "I need this to work for other people as well" type of issue. Don't worry about it. I already got the fix. I just wanted someone to take look at that patch and tell me If there is something I should know about.
Demiurge
2024-04-27 10:39:20
Ok πŸ˜‚
2024-04-27 10:49:40
It's just annoying because it looks like cjxl is using the C api correctly and Windows can't make up it's mind what sort of hoops the programmer should have to jump through in order for it to work as expected
2024-04-27 10:54:10
For what it's worth, the patch makes sense to me, except for the changes to add_definitions/add_compile_options, that's some cmake greek to me.
2024-04-27 10:55:02
but I'm just a fox
spider-mario
Demiurge but I'm just a fox
2024-04-27 11:05:34
TORYAH
lonjil
Demiurge It's just annoying because it looks like cjxl is using the C api correctly and Windows can't make up it's mind what sort of hoops the programmer should have to jump through in order for it to work as expected
2024-04-27 11:05:35
there is no such thing as "using the C api correctly"
spider-mario
2024-04-27 11:05:36
https://youtu.be/zRTP3QgOBSo
Demiurge
2024-04-28 12:12:00
FIYAA!
2024-04-28 12:14:26
https://i.kym-cdn.com/photos/images/original/001/005/231/17f.jpg
lonjil there is no such thing as "using the C api correctly"
2024-04-28 12:17:18
https://en.cppreference.com/w/c/io/fopen
2024-04-28 12:50:34
C has a standard library, and a specified way of relying upon it, in order to open files, so I don't know what you possibly mean.
2024-04-28 01:04:55
Hmm, I'm trying to find out more information about text encoding for arguments in python's subprocess module...
2024-04-28 01:07:41
Sorry, I can't seem to find anything useful, I thought I did at first but no. :(
2024-04-28 01:10:09
According to this: https://peps.python.org/pep-0529/ ...you might be able to pass filenames as arguments to cjxl by wrapping them in os.fsencode()
Code Poems
2024-04-28 01:31:21
As I mentioned before, this is not an issue with Python, but with the `libjxl` itself. `subprocess.run` natively supports UTF-8. I tried the `os.fsencode()` workaround and this is the result > Could not open C:\Users\user\Desktop\???.jxl for writing > Error: No such file or directoryCould not write jxl file. I've spent so many hours trying out different workarounds, and I just don't want to anymore. If `cjxl.exe` cannot open it, no amount of Python trickery can make it work. Yes, I tried changing code page, specifying UTF encoding, pretty much everything. `libavif` used to have the same problem, until recently. The patch I posted is based on their approach https://github.com/AOMediaCodec/libavif/commit/3ec01cefd1ddd266a622d5e114a0888581b68f4a
Meow
2024-04-28 06:52:50
`cjxl anim-icos.png anim-icos.jxl -d 0 JPEG XL encoder v0.10.2 0.10.2 [AVX2,SSE4,SSE2] Getting pixel data failed.` I can't make it work, downloaded from https://jpegxl.info/test-page/, neither .apng nor .png
jonnyawsom3
Meow `cjxl anim-icos.png anim-icos.jxl -d 0 JPEG XL encoder v0.10.2 0.10.2 [AVX2,SSE4,SSE2] Getting pixel data failed.` I can't make it work, downloaded from https://jpegxl.info/test-page/, neither .apng nor .png
2024-04-28 08:14:41
https://github.com/libjxl/libjxl/issues/3430
Meow
2024-04-28 08:21:15
Uh I missed this one
Demiurge
2024-04-30 10:57:57
Is it okay to use latest git libjxl if `JxlTest.RoundtripLargeEmptyModular` fails? I can't find any information about the testing harness...
Tirr
2024-05-02 06:09:31
can I make `ci.sh` skip building test binaries? `SKIP_TEST=1` skips *running* tests but not building those.
veluca
2024-05-02 06:35:40
-DBUILD_TESTING=Off probably does that
Tirr
veluca -DBUILD_TESTING=Off probably does that
2024-05-02 02:09:57
didn't know that `ci.sh` accepts extra cmake arguments, that works. thanks!
Meow
2024-05-04 04:51:17
How to convert greyscale images correctly? cjxl results a larger but "empty" .jxl file
spider-mario
2024-05-04 04:53:54
sounds like a bug somewhere
2024-05-04 04:54:07
does it look empty regardless of viewer? what does `jxlinfo` say about it?
Meow
spider-mario does it look empty regardless of viewer? what does `jxlinfo` say about it?
2024-05-04 04:57:39
Completely empty regardless of viewer. The prompt was simply `cjxl -d 0`
2024-05-04 04:57:49
`JPEG XL image, 3500x3500, (possibly) lossless, 8-bit Grayscale+Alpha Color space: Grayscale, D65, sRGB transfer function, rendering intent: Relative`
spider-mario
2024-05-04 04:58:41
is the alpha correct?
2024-05-04 04:59:12
perhaps worth trying to compress a version of the PNG without it, just to check
Meow
2024-05-04 05:12:51
Uh so without Alpha, cjxl can work correctly. I was mistakenly thinking about if ImageOptim was a cause
2024-05-04 05:15:05
With the Alpha channel, the tested greyscale image without being optimised by ImageOptim still becomes empty via cjxl
2024-05-04 05:16:03
Regardless the status, resulted JXL files are always larger than optimised PNGs
2024-05-04 05:17:24
The tested greyscale PNG images are generated by Clip Studio Paint
2024-05-04 05:19:15
For other codecs, libavif and libwebp can work correctly but libheif corrupts severely
2024-05-04 05:26:26
Tried another image and the resulted JXL remained empty
2024-05-04 05:26:52
Although it's smaller this time
2024-05-04 05:37:38
Thus the possible issue is from "8-bit Grayscale+Alpha"
_wb_
2024-05-04 09:12:26
Those filesizes of the jxl files seem to indicate they do actually do contain the data. Maybe it's a bug in how the decoded image is passed back?
Quackdoc
Meow Although it's smaller this time
2024-05-04 09:19:48
is this a bad jxl? its decoding fine for me
spider-mario
2024-05-04 09:22:02
Affinity Photo displays it properly
2024-05-04 09:22:20
username
2024-05-04 09:22:32
whatever their OS or file browser is using to decode JXL files might be on some version of libjxl that fails to decode it?
gbetter
2024-05-04 09:24:23
I've been having problems with "8-bit Grayscale+Alpha" PNG->JXL on MacOS forever. My solutions are 1) convert to RGB in Photoshop and save as new PNG or 2) "Flatten Image" in Photoshop then save as a new grayscale PNG. either of those changes produce a PNG that converts to jxl just fine.
2024-05-05 03:07:33
So here's a real-world, in-the-wild example of the problems I'm running into with some grayscale PNG files with alpha channels This is not my photo, it was a PNG downloaded off twitter as a PNG. Original PNG from Twitter opens just fine with every app I have that reads PNG That PNG converted to JXL as follows is broken almost everywhere (Adobe Camera Raw seems to read it, messing up only the gamma) The conversion with relevant info (macOS Sonoma 14.4.1): xxxxx xxxxx % cjxl --version cjxl v0.10.2 0.10.2 [NEON] Copyright (c) the JPEG XL Project xxxxx xxxxx % file original.png original.png: PNG image data, 1024 x 1280, 8-bit gray+alpha, non-interlaced xxxxx xxxxx % cjxl original.png converted.jxl JPEG XL encoder v0.10.2 0.10.2 [NEON] Encoding [VarDCT, d1.000, effort: 7] Compressed to 62472 bytes (0.381 bpp). 1024 x 1280, 5.529 MP/s [5.53, 5.53], , 1 reps, 12 threads. xxxxx xxxxx % file converted.jxl converted.jxl: JPEG XL codestream xxxxx xxxxx % jxlinfo converted.jxl JPEG XL image, 1024x1280, lossy, 8-bit Grayscale+Alpha Color space: Grayscale, D65, gamma(0.454550) transfer function, rendering intent: Relative Opening both original.png and converted.jxl in Acorn reveals the JXL to be stretched horizontally, cropped off and translucent - unusable.
2024-05-05 03:08:04
Opening both original.png and converted.jxl in Photoshop forces Adobe Camera Raw to open the JXL first, then it opens in Photoshop with darker gamma, I can recover the hair where it gets dark but it no longer looks the same by default.
2024-05-05 03:08:16
2024-05-05 03:08:54
Apple Preview will open the JXL stretched, cropped and weirdly interlaced. (zoomed on right to show interlacing)
2024-05-05 03:09:50
Mac Finder and Safari will just show blank white. When I examine the Twitter-downloaded PNGs that won't convert correctly (like this one), they consistently show a single translucent column of pixels on the right-hand side, I've seen this exact same pattern on a hundred or more images.
Meow
username whatever their OS or file browser is using to decode JXL files might be on some version of libjxl that fails to decode it?
2024-05-05 05:46:02
I tested on macOS 14.4.1
gbetter I've been having problems with "8-bit Grayscale+Alpha" PNG->JXL on MacOS forever. My solutions are 1) convert to RGB in Photoshop and save as new PNG or 2) "Flatten Image" in Photoshop then save as a new grayscale PNG. either of those changes produce a PNG that converts to jxl just fine.
2024-05-05 06:35:24
Just a workaround. Having to convert to RGB all the time is annoying
2024-05-05 06:36:57
Grayscale is a big sector for artworks but the usage of grayscale+alpha is relatively rare
2024-05-05 07:06:13
The potential big usage could be exchanging clips of comics
_wb_
2024-05-05 07:54:16
Grayscale is somehow something that always causes trouble. E.g. what transfer curve to apply to untagged grayscale images is something applications still disagree on, iirc.
Meow
2024-05-05 01:51:47
It seems that GIMP and Thorium can read
Crite Spranberry
2024-05-05 06:30:52
How does r3dfox handle them? <https://github.com/Eclipse-Community/r3dfox/releases/tag/125.0.3>
username
Crite Spranberry How does r3dfox handle them? <https://github.com/Eclipse-Community/r3dfox/releases/tag/125.0.3>
2024-05-05 06:34:51
works fine. I even tested a fork of Firefox without the unmerged JXL patches and it worked fine as well.
Crite Spranberry
2024-05-05 06:38:10
<:astolfoarc_thumbs_up:1152603499230675054>
Demiurge
gbetter So here's a real-world, in-the-wild example of the problems I'm running into with some grayscale PNG files with alpha channels This is not my photo, it was a PNG downloaded off twitter as a PNG. Original PNG from Twitter opens just fine with every app I have that reads PNG That PNG converted to JXL as follows is broken almost everywhere (Adobe Camera Raw seems to read it, messing up only the gamma) The conversion with relevant info (macOS Sonoma 14.4.1): xxxxx xxxxx % cjxl --version cjxl v0.10.2 0.10.2 [NEON] Copyright (c) the JPEG XL Project xxxxx xxxxx % file original.png original.png: PNG image data, 1024 x 1280, 8-bit gray+alpha, non-interlaced xxxxx xxxxx % cjxl original.png converted.jxl JPEG XL encoder v0.10.2 0.10.2 [NEON] Encoding [VarDCT, d1.000, effort: 7] Compressed to 62472 bytes (0.381 bpp). 1024 x 1280, 5.529 MP/s [5.53, 5.53], , 1 reps, 12 threads. xxxxx xxxxx % file converted.jxl converted.jxl: JPEG XL codestream xxxxx xxxxx % jxlinfo converted.jxl JPEG XL image, 1024x1280, lossy, 8-bit Grayscale+Alpha Color space: Grayscale, D65, gamma(0.454550) transfer function, rendering intent: Relative Opening both original.png and converted.jxl in Acorn reveals the JXL to be stretched horizontally, cropped off and translucent - unusable.
2024-05-05 09:46:16
This looks suspiciously a lot like the bug with jpegli and images with alpha channel
2024-05-05 09:46:41
Wonder if it's related
Meow
username works fine. I even tested a fork of Firefox without the unmerged JXL patches and it worked fine as well.
2024-05-06 08:20:10
Or the issue is from built-in libjxl in macOS
2024-05-06 08:24:23
However cjxl still produces much larger greyscale .jxl files regardless Alpha
afed
2024-05-07 12:10:16
<@794205442175402004> maybe for lossless it's also not that much needed by default in most cases (like webp lossless)? https://github.com/libjxl/libjxl/pull/3562
_wb_ Perhaps we should change our PNG reading/writing and get rid of the dependency to libpng. We could use lodepng for decoding and fpnge for encoding instead. As a side effect, cjxl and particularly djxl would get faster from the end-user point of view (especially djxl is currently often spending most of its wall time on png encoding of the decoded image, not on the decoding itself). WDYT, <@&803357352664891472> ? (also we should stop using libjpeg-turbo/sjpeg for reading/writing jpegs and use jpegli instead)
2024-05-07 12:18:37
maybe start with integrating fpnge at least (would be nice) or some simpler things? other core devs seem to have other priorities for now <:FeelsSadMan:808221433243107338> fpnge also still doesn't have ppm support
_wb_
2024-05-07 12:19:28
one issue with fpnge is that it's not portable, it's hardcoded for x64 iirc
afed
2024-05-07 12:28:29
sad, it would give fpnge a second life and not to be abandoned but at least as an option for x64 and official binaries, and because png decoding still uses libs with encoding capability if fpnge doesn't support something
2024-05-07 12:44:17
or maybe jpegli first and also because it's already in the libjxl repository anyway, but it would be better to use some extended features, not just the libjpeg api and I would say, a lot of time and work spent on developing something, but then very little initiative to bring it to the masses and make it more polished and usable like jpegli has no standalone libraries that are easy to integrate and distribute, so people after the initial hype of the announcement may forget that jpegli exists <:PepeHands:808829977608323112>
yoochan
2024-05-07 01:16:50
jpegli is an amazing feat but it brought many confusion for non tech readers
veluca
2024-05-07 01:32:08
it's not *too* hard to make fpnge work on non-x86
2024-05-07 01:32:24
just never had enough motivation for it πŸ˜„
Vlad (Kuzmin) Erium
2024-05-07 01:34:31
Trying to understand how exif meta-data writing working. Use cjxl for that. In debug mode check AddBox steps that looping for exif, jumbf, iptc and xml boxes. And see that all boxes except xml is empty. Source image jpeg or png have exif metadata. And output Jxl also have exif metadata block. What I missing in process? Did box decoder import all meta data to XMP and encoder encode this data back to exif/xmp/iptc back?
afed
veluca just never had enough motivation for it πŸ˜„
2024-05-07 02:00:28
so when fpnge is integrated into libjxl it won't just be a project for fun <:KekDog:805390049033191445>
_wb_
Vlad (Kuzmin) Erium Trying to understand how exif meta-data writing working. Use cjxl for that. In debug mode check AddBox steps that looping for exif, jumbf, iptc and xml boxes. And see that all boxes except xml is empty. Source image jpeg or png have exif metadata. And output Jxl also have exif metadata block. What I missing in process? Did box decoder import all meta data to XMP and encoder encode this data back to exif/xmp/iptc back?
2024-05-07 03:30:26
the exif box is called `Exif`, not `exif`
Vlad (Kuzmin) Erium
2024-05-07 03:39:55
Right. But a question not it it name but a process. I see that a code skip all except xml but final jxl file still have exif data. I guess that all original meta data in xml box?
Meow
afed <@794205442175402004> maybe for lossless it's also not that much needed by default in most cases (like webp lossless)? https://github.com/libjxl/libjxl/pull/3562
2024-05-07 05:31:49
The issue was simply for not following the designated behaviour
2024-05-07 05:33:01
`--keep_invisible=0|1 disable/enable preserving color of invisible pixels (default: 1 if lossless, 0 if lossy).`
2024-05-07 05:34:29
It's nothing to do with which one is better or not
afed
2024-05-07 05:38:33
yeah, but I mean it can also be changed for lossless by default, because in most common use cases it's not needed and will slightly improve compression and there's still an option to enable it if needed for specific cases
Meow
2024-05-07 05:39:43
But is it still technically lossless?
afed
2024-05-07 05:41:44
visually it's still lossless, but there may be some data lost, but in most images it's just junk data (from some editors, wrong conversion, etc)
Meow
2024-05-07 05:44:40
Then default to 1 would be safe for the absolutely lossless needs
Quackdoc
2024-05-07 06:04:25
Speaking of keep invisible, Does enabling associated alpha also enable keep invisible?
afed visually it's still lossless, but there may be some data lost, but in most images it's just junk data (from some editors, wrong conversion, etc)
2024-05-07 06:07:36
for non associated alpha this is true. 1,0,0,0 is not a valid colour, but for associatied alpha it is
2024-05-07 06:07:51
so it matters a lot for proper compositing in color managed pipelines
2024-05-07 06:08:52
Unfortunately, this is needed because There are image formats that don't properly signal whether or not they're associated with alpha or not.
2024-05-07 06:09:17
That being said, if you're encoding from a PNG, you can always do it because PNGs are never associated alpha. So you could do it input aware, I suppose.
2024-05-07 06:17:04
* PNG you can always discard since it is never associated alpha so it's fine to discard even during lossless encoding if you want to maintain spec accuracy (PNGs encoded for associated alpha does exist but they violate the spec) * ppm based, don't signal, so it's not ok to discard lossless, but probably fine for lossy * EXR is always associated alpha, so it should never discard invisible pixels even during lossy encoding
Meow
2024-05-07 06:20:30
What would keep_invisible=0 do for EXR converted to lossy JXL? I've never used it
Quackdoc
2024-05-07 06:24:25
not all EXRs have invisible pixels with color data, so those would be fine. some EXRs will completely break however
Meow
Quackdoc not all EXRs have invisible pixels with color data, so those would be fine. some EXRs will completely break however
2024-05-07 06:27:43
Will the image look corrupted with invisible pixels?
Quackdoc
2024-05-07 06:29:08
not corrupted, but color data would be all sorts of messed up, imagine a candle in a dark room, the glow of the candle gives a yellow-orangeish tint to everything in the room right? so imagine a picture like that, but just completely missing the yellow-orangeish tint
2024-05-07 06:30:07
depending on how the image is encoded, it may also be missing the flame
Meow
2024-05-07 06:31:36
That could be kind of "lossy"
Quackdoc
2024-05-07 06:32:09
well it would be very lossy, as it would completely destroy the image when rendered out
spider-mario
2024-05-07 06:37:10
there _are_ no invisible pixels in EXR, are there?
2024-05-07 06:37:59
since any non-zero pixel data is supposed to be added to the (optionally occluded by alpha) background
2024-05-07 06:39:02
any non-negligible change to the pixel data is potentially visible
Quackdoc
2024-05-07 06:44:06
I thought the background was optional? but that would give context to this issue https://gitlab.gnome.org/GNOME/gimp/-/issues/5370 https://twitter.com/jkierbel/status/1210235542404775945
2024-05-07 06:44:37
<@277378565304090636> for reference as to how it would look, these are good things to read
Meow
2024-05-07 06:49:12
The result is the same on my GIMP
2024-05-07 06:50:17
My other viewers can't open it at all
Quackdoc
2024-05-07 06:52:52
gimp is just bugged, if you go into `channels` then disable the alpha it should render
Meow
Quackdoc gimp is just bugged, if you go into `channels` then disable the alpha it should render
2024-05-07 06:54:15
Yeah I actually referred to the GitLab page
Quackdoc
2024-05-07 06:54:35
interesting result from the encoded jxl image
2024-05-07 06:57:44
oculante's preview renders it right but not the main image viewer
Meow
2024-05-07 06:57:57
The issue has been opened for 3 years
Quackdoc
2024-05-07 07:04:36
oh good `cjxl ../CCSkull_Linear709.exr test-skull-invis-no-pre.jxl -d 1 --keep_invisible=0 --premultiply=1` keeps the no alpha pixels [pepeHappy](https://cdn.discordapp.com/emojis/1160370117302046780.webp?size=48&quality=lossless&name=pepeHappy)
Quackdoc interesting result from the encoded jxl image
2024-05-07 10:25:51
oh i wonder if the transfer is messed up with this
lonjil
2024-05-07 10:29:35
Okular renders it on a pure white background, funny
2024-05-07 10:30:12
KDE's thumbnail generator fucks it up
Quackdoc
2024-05-07 10:30:40
krita has the same issue where you need to disable the alpha, but it renders the jxl properly unlike gimp.
Quackdoc interesting result from the encoded jxl image
2024-05-07 10:37:31
im an idiot, like a massive idiot, this is because with alpha disabled, all of the pixels are as if they were solid, the fact that krita doesn't have this issue, just means krita is really weird
2024-05-07 10:56:56
it works with olive *perfectly* even when compositing other images, ffmpeg didn't properly tag it as associated alpha though, so I needed to manually do that
Demiurge
_wb_ one issue with fpnge is that it's not portable, it's hardcoded for x64 iirc
2024-05-07 11:13:04
maybe fpnge could use smde for portability :)
2024-05-07 11:13:35
cross platform intrinsics
2024-05-07 11:16:45
https://github.com/simd-everywhere/simde
_wb_
Quackdoc oh good `cjxl ../CCSkull_Linear709.exr test-skull-invis-no-pre.jxl -d 1 --keep_invisible=0 --premultiply=1` keeps the no alpha pixels [pepeHappy](https://cdn.discordapp.com/emojis/1160370117302046780.webp?size=48&quality=lossless&name=pepeHappy)
2024-05-08 08:01:09
IIRC we never modify the color of invisible pixels in the premultiplied/associated case, since 1) it would be incorrect if invisible pixels are not black, and 2) it would be unneeded if the image was originally unassociated and converted to associated, since then invisible pixels automatically become black.
2024-05-08 08:08:50
Some PNG optimizers do change the color of invisible pixels, often by making them repeat the color of the last visible pixel on each row (which is good for DEFLATE). This can introduce weird horizontal lines in the colors of invisible regions, which is not that great for VarDCT since those lines can be high-contrast high-frequency which is expensive for DCT encoding and can cause ringing artifacts that bleed into the visible parts. That's why changing the invisible pixels (turning them into a blurry mess that smoothly blends into the visible part) can be good for both compression (less entropy to encode) and quality (no artifacts bleeding into the visible part).
2024-05-08 08:11:36
The "blurry mess" thing is good for VarDCT but for lossless probably something else would be better (not sure how to do it, but basically make the invisible pixels correspond to zero residuals β€” the tricky thing here is that we don't know the predictor until the encoding is done, so it's hard to do this as just a pre-processing step).
spider-mario
_wb_ IIRC we never modify the color of invisible pixels in the premultiplied/associated case, since 1) it would be incorrect if invisible pixels are not black, and 2) it would be unneeded if the image was originally unassociated and converted to associated, since then invisible pixels automatically become black.
2024-05-08 08:56:41
re: 1), afaict, it’s incorrect even then, since making them anything else than black (i.e. modifying them) would then make them visible
_wb_
2024-05-08 09:04:06
right, any change is incorrect in the associated case
JendaLinda
2024-05-08 10:42:32
I've seen some formats used by games where fully transparent pixels are not encoded at all and they are simply skipped over.
_wb_
2024-05-08 01:03:38
FLIF can do that β€” but it's a pretty bad idea for speed, introduces extra branching in the decoder
2024-05-08 01:08:17
I suppose one trick we could apply to make invisible pixels "don't care, don't spend any bits" in modular mode, is to first permute the channels with RCTs so Alpha comes first, and then make sure the MA tree has a context for the A=0 case, with the predictor set to the Zero predictor. Then you can make all invisible pixels black and they will be in a context that has only zero symbols so it gets a singleton histogram and uses zero bits per symbol.
2024-05-08 01:11:01
^ this kind of thing is why I love the expressivity of Modular β€” you can replicate FLIF's "skip invisible pixels" concept just by using modular transforms and MA trees
JendaLinda
2024-05-08 01:14:12
That sounds like a good idea. Also black pixels look better than random mess when viewed with alpha disabled.
2024-05-08 01:54:27
In the case of the game, skipping over the transparent parts actually increased the rendering speed as only the non-transparent pixels had to be drawn on the screen.
2024-05-08 02:31:46
I've noticed a regression in lossless jpeg transcoding. The same jpeg files result in slightly bigger jxl files. I'm not sure when the change happened. Any idea what caused that?
Quackdoc
_wb_ IIRC we never modify the color of invisible pixels in the premultiplied/associated case, since 1) it would be incorrect if invisible pixels are not black, and 2) it would be unneeded if the image was originally unassociated and converted to associated, since then invisible pixels automatically become black.
2024-05-08 02:57:08
it's nice that they aren't modified for sure. I ill for sure look into JXL for replacing *some* parts where I would use EXR
Oleksii Matiash
JendaLinda I've noticed a regression in lossless jpeg transcoding. The same jpeg files result in slightly bigger jxl files. I'm not sure when the change happened. Any idea what caused that?
2024-05-08 04:13:28
I believe in 0.10, it tends to produce very slightly larger files than 0.9
monad
2024-05-08 04:14:11
0.8 is the smallest
_wb_
2024-05-08 04:19:38
Often when the encoder gets tuned, quality/bpp improves but also bpp gets a little bit higher for the same settings.
JendaLinda
2024-05-08 04:41:27
I don't know what settings I could try for lossless jpeg transcoding, there's only the effort which seems to be limited to 10.
monad
2024-05-08 04:46:12
E
afed
2024-05-08 04:47:19
yeah `-E 3` or some other `-E xxx`
JendaLinda
2024-05-08 05:02:11
Interesting. I thought E was only for modular.
2024-05-08 05:16:34
Hmm -E has no effect on lossless jpeg transcode
monad
2024-05-08 05:38:45
oh
afed
2024-05-08 05:47:11
on older versions there was a difference, but not on all images
JendaLinda
2024-05-09 09:50:33
By tinkering with the source jpeg files I noticed the size of the jbrd box can be influenced. If the only thing to care about is to preserve the visual data and being able to revert to jpeg format, I figured out how to minimize the size of jbrd. 1) use Baseline jpeg with optimized Huffman tables. Either Progressive jpeg or "unoptimized" Huffman would increase the size of jbrd. 2) remove the JFIF header. As cjpegli does not write JFIF header at all, I suppose bare jpegs should be just fine.
Oleksii Matiash
JendaLinda By tinkering with the source jpeg files I noticed the size of the jbrd box can be influenced. If the only thing to care about is to preserve the visual data and being able to revert to jpeg format, I figured out how to minimize the size of jbrd. 1) use Baseline jpeg with optimized Huffman tables. Either Progressive jpeg or "unoptimized" Huffman would increase the size of jbrd. 2) remove the JFIF header. As cjpegli does not write JFIF header at all, I suppose bare jpegs should be just fine.
2024-05-09 09:55:45
re > 2) Some (ancient?) apps treat such jpegs as corrupt
jonnyawsom3
JendaLinda By tinkering with the source jpeg files I noticed the size of the jbrd box can be influenced. If the only thing to care about is to preserve the visual data and being able to revert to jpeg format, I figured out how to minimize the size of jbrd. 1) use Baseline jpeg with optimized Huffman tables. Either Progressive jpeg or "unoptimized" Huffman would increase the size of jbrd. 2) remove the JFIF header. As cjpegli does not write JFIF header at all, I suppose bare jpegs should be just fine.
2024-05-09 10:03:06
The jpeg to JXL conversion is almost a fixed 20% reduction, or at least was, so it's always been advised to optimise the joegs first before transcoding for maximum savings
Oleksii Matiash
The jpeg to JXL conversion is almost a fixed 20% reduction, or at least was, so it's always been advised to optimise the joegs first before transcoding for maximum savings
2024-05-09 10:26:13
Progressive jpegs result in slightly larger jxls than baseline
username
2024-05-09 10:26:54
iirc the actual JPEG data gets compressed the same way no matter the metadata or whether or not it's progressive, it's just the reconstruction data that's used to bring back the original JPEG that changes
Oleksii Matiash
2024-05-09 10:26:57
I believe somebody explained this, but I forgot both who it was and explanation πŸ˜”
jonnyawsom3
Oleksii Matiash Progressive jpegs result in slightly larger jxls than baseline
2024-05-09 10:30:56
How many files have you tested where this is the case?
Oleksii Matiash
2024-05-09 10:35:03
Lot of. Actually I wrote a script that produces 3 jpeg variants, compresses it, and leaves smallest. And the result was: optimized and non-optimized baseline produces the same jxl, progressive - a bit larger. Probably there were exclusions, but in general it was so
JendaLinda
2024-05-09 10:41:58
From what I found, the difference between baseline and progressive jpegs was only in the jbrd size.
2024-05-09 10:44:11
Adding a new JFIF marker where it's missing is easy enough to do.
Oleksii Matiash
2024-05-09 10:49:14
Maybe I should do that test again..
JendaLinda
2024-05-09 11:05:39
Optimizing jpegs before transcoding to jxl is deffinitely a good idea. This can fix slightly broken files that wouldn't transcode directly. The another topic is optimizing metadata. EXIF is a mess. It's often bloated with data most users don't need. The only metadata I care about is: 1) a timestamp in UTC format 2) a comment in UTF-8 format 3) geographic coordinates The rest can be discarded. Also the jpeg thumbnail can go away as it can be always recreated and jpeg thumbnails don't work inside jxl anyway.
Oleksii Matiash
JendaLinda Optimizing jpegs before transcoding to jxl is deffinitely a good idea. This can fix slightly broken files that wouldn't transcode directly. The another topic is optimizing metadata. EXIF is a mess. It's often bloated with data most users don't need. The only metadata I care about is: 1) a timestamp in UTC format 2) a comment in UTF-8 format 3) geographic coordinates The rest can be discarded. Also the jpeg thumbnail can go away as it can be always recreated and jpeg thumbnails don't work inside jxl anyway.
2024-05-09 11:32:35
We are all different. I don't care about comments and coordinates, but need information about camera. So I use exiftool with -photoshop:all= -xmp:all= -Software=