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

tools

Traneptora
2023-10-17 02:54:37
this produces this
2023-10-17 02:54:47
2023-10-17 02:55:16
which uses cICP
2023-10-17 02:56:11
my viewer doesn't support cICP so it's rendering it as-is as sRGB
2023-10-17 02:56:19
if you use a PQ ICC Profile instead
Olav
2023-10-17 02:56:31
I tried with `--color_space=RGB_D65_SRG_Per_SRG`, it created something that looks correct.
Traneptora
2023-10-17 02:57:05
Yup, the issue here with the washed out is that it's interpreting a 16-bit PQ image as sRGB
2023-10-17 02:57:06
which is incorrect
2023-10-17 02:57:25
2023-10-17 02:57:33
this is what happens if you use an ICC profile, which Eye of MATE supports
2023-10-17 03:00:27
In other words, with the above image:
2023-10-17 03:00:46
If you see this, it means no peak detection was run. It is not mathematically incorrect, but it is undesirable:
2023-10-17 03:01:40
If you see this, it means that libjxl is outputting PQ/BT.2020 data, but the rendering engine thinks it's sRGB, and is rendering the pixels as sRGB. This is incorrect.
2023-10-17 03:02:46
If you see this, or something similar, then something most likely correct is happening.
Olav
2023-10-17 03:03:19
Thanks for the detailed info. 🙂
Traneptora
2023-10-17 03:03:25
Again, there's no unique correct way to do it, but there are incorrect ways.
2023-10-17 03:03:46
np :)
Quackdoc
2023-10-17 03:13:04
ah tonemapping what a mess
veluca I wish people would stop thinking that images can be displayed without colorspaces...
2023-10-17 03:14:55
tfw You grade for SRGB, but you have no idea if SRGB actually means SRGB or a pure gamma 2.2 transfer.
2023-10-17 03:16:00
https://tenor.com/view/luck-zoro-one-piece-anime-cartoon-gif-8600231
2023-10-17 03:19:07
I wonder if we will ever be able to leave all relative luminance transfers
Traneptora
Quackdoc tfw You grade for SRGB, but you have no idea if SRGB actually means SRGB or a pure gamma 2.2 transfer.
2023-10-17 03:21:10
doesn't help with things like the IM bug that treated `sRGB` chunks as though they were gamma45 and not actually sRGB
2023-10-17 03:21:30
gamma45 being `0.45455` aka `1/2.2` (that's how it's tagged in the PNG)
Quackdoc
2023-10-17 03:22:59
I always knew srgb transfer shenangians was an issue, but I never knew just how rampant of an issue it was until I watched this video https://youtu.be/NzhUzeNUBuM?si=krF_m0fYdN8MalBO
2023-10-17 03:23:18
basically, whether or not something uses a real srgb transfer or not is around 50:50
2023-10-17 03:23:28
so like, at this point I dont even care anymore
tufty
2023-10-27 07:10:34
<@208917283693789185> made a windows build of vipsdisp https://github.com/jcupitt/vipsdisp/releases/tag/v2.6.1
2023-10-27 07:10:49
it includes jxl support, so you can load and save JXL images
2023-10-27 07:13:48
-Julian-
Fraetor I've got a simple parser that gets the width and height. https://github.com/Fraetor/jxl_decode/blob/main/src/jxl_decode/jxl.py You also need to check for the following bytes, for the case of an image in a container. `0000 000C 4A58 4C20 0D0A 870A`
2023-11-11 06:44:45
I have never worked with images at the byte level yet. how were you able to derive this stuff?
Fraetor
-Julian- I have never worked with images at the byte level yet. how were you able to derive this stuff?
2023-11-11 08:32:20
I did it by reading the spec. Part 1 is for the codestream itself. You can find a copy here: https://discord.com/channels/794206087879852103/1021189485960114198/1169087534060556339
-Julian-
2023-11-11 08:46:53
i dont understand this 😭
Fraetor
2023-11-11 08:48:50
Its a little unintuitive. You can skip the first few section, as they are mostly just definitions, and go down to Annex D, which is the definition of the Image header.
2023-11-11 08:49:29
Some of the fields described in the table there have their own tables elsewhere in the specification.
2023-11-11 08:50:10
Just in case, the files in the specification channel are HTML, so they should be downloaded from discord and opened in a broswer to view.
bonnibel
2023-11-24 11:22:08
Anyone else suddenly having trouble with ffmpeg jxl encoding?
2023-11-24 11:23:03
I keep getting "[libjxl] Failed to add Image Frame" w the latest build, was fine a few days ago
Traneptora
bonnibel I keep getting "[libjxl] Failed to add Image Frame" w the latest build, was fine a few days ago
2023-11-25 03:30:44
nothing changed in FFmpeg's jxl code, what are you trying to do?
2023-11-25 03:31:26
like, what's the command and version of FFmpeg and libjxl?
2023-11-25 03:31:34
what version worked "a few days ago"
bonnibel
2023-11-25 04:01:24
I'm using the daily windows builds from a community github action minimal command is simply `.\ffmpeg.exe -i in.pfm out.jxl` latest daily build that worked: <https://github.com/zhongfly/mpv-winbuild/actions/runs/6956960419> first daily build that didnt: <https://github.com/zhongfly/mpv-winbuild/actions/runs/6969372061> latest commits of all packages used are listed in the summary if you scroll down a bit. i'm using the ffmpeg-x86_64_v3-git-[hash] artifacts
Traneptora
bonnibel I'm using the daily windows builds from a community github action minimal command is simply `.\ffmpeg.exe -i in.pfm out.jxl` latest daily build that worked: <https://github.com/zhongfly/mpv-winbuild/actions/runs/6956960419> first daily build that didnt: <https://github.com/zhongfly/mpv-winbuild/actions/runs/6969372061> latest commits of all packages used are listed in the summary if you scroll down a bit. i'm using the ffmpeg-x86_64_v3-git-[hash] artifacts
2023-11-25 04:47:35
nothing relating to libjxl was changed here https://github.com/FFmpeg/FFmpeg/commits/master
2023-11-25 04:47:41
it may be a regression in libjxl itself
2023-11-25 04:48:15
if I had to guess, this commit may be the culprit
2023-11-25 04:48:16
https://github.com/libjxl/libjxl/commit/b59e312125138bbc9623fcd9749ba02567d6c9f2
bonnibel I'm using the daily windows builds from a community github action minimal command is simply `.\ffmpeg.exe -i in.pfm out.jxl` latest daily build that worked: <https://github.com/zhongfly/mpv-winbuild/actions/runs/6956960419> first daily build that didnt: <https://github.com/zhongfly/mpv-winbuild/actions/runs/6969372061> latest commits of all packages used are listed in the summary if you scroll down a bit. i'm using the ffmpeg-x86_64_v3-git-[hash] artifacts
2023-11-25 05:02:16
anyway, full command output?
bonnibel
2023-11-25 05:11:00
<https://pastebin.com/aU0azXxU>
Traneptora
bonnibel <https://pastebin.com/aU0azXxU>
2023-11-25 05:16:30
you would need to use a debug build of libjxl for more info
2023-11-25 05:16:46
can you provide the sample?
bonnibel
2023-11-25 05:29:25
Traneptora
2023-11-26 03:01:45
<@178524721023811584> the problem is on line 2270 of lib/jxl/encode.cc
2023-11-26 03:01:53
https://github.com/libjxl/libjxl/commit/6bd63f5880a36bc94172ff285064ebb1743b1964
2023-11-26 03:02:12
https://github.com/libjxl/libjxl/blob/main/lib/jxl/encode.cc#L2270
2023-11-26 03:03:01
the size of `color_data` should not `bytes_per_pixel * xsize * ysize` but rather should take into account `jxl_format.align`
2023-11-26 03:03:14
the problem is FFmpeg is passing a buffer with a linesize of 576
2023-11-26 03:03:19
which used to work, before this commit
2023-11-26 03:03:38
and libjxl is rejecting the buffer as "too small" (it's not) because the buffer it's rejecting is actually this one allocated here called color_data
2023-11-26 03:15:04
<@178524721023811584> https://github.com/libjxl/libjxl/issues/2971
bonnibel
2023-11-26 02:11:07
ah, thanks for figuring that out!
Demiurge
2023-11-27 12:10:33
Nice. It's great you reported the problem.
Traneptora
bonnibel ah, thanks for figuring that out!
2023-11-29 10:08:57
can you test latest git main? may have been fixed
2023-11-30 02:16:50
Interesting, the gdk pixbuf loader appears to be having issues with orange2.jxl
2023-11-30 02:16:56
2023-11-30 02:16:59
libjxl handles it fine
2023-11-30 02:17:05
as does ffmpeg, djxl, etc.
2023-11-30 02:17:07
and GIMP
2023-11-30 02:17:21
but running eye of mate on it crashes, wonder if the gdk pixbufloader is just out of date?
bonnibel
Traneptora can you test latest git main? may have been fixed
2023-12-01 12:47:19
seems fixed! thanks
2023-12-01 12:48:35
now i just need to figure out why vf_libplacebo chokes on grayf32 but not on gbrpf32 input and most of my ffmpeg woes will be gone
2023-12-01 12:49:04
(I already opened an issue for that in the libplacebo repo since I think the problem's somewhere in there, but it's been languishing for the past month sadly)
Traneptora
bonnibel now i just need to figure out why vf_libplacebo chokes on grayf32 but not on gbrpf32 input and most of my ffmpeg woes will be gone
2023-12-01 02:19:39
I can investigate if you link
bonnibel
2023-12-01 02:21:08
<https://github.com/haasn/libplacebo/issues/214>
Traneptora
bonnibel <https://github.com/haasn/libplacebo/issues/214>
2023-12-01 05:35:07
https://code.videolan.org/videolan/libplacebo/
2023-12-01 05:35:09
open it here
bonnibel
2023-12-01 04:12:31
yes but consider: issues & prs in the gh mirror do get addressed and i did not want to make an account on the videolan github
2023-12-02 04:26:40
ah apparently they just have long standing issues with floating point yuv
2023-12-02 04:41:25
and now finally found a bug thats definitely in ffmpeg itself lol
2023-12-02 04:41:49
```bash # Create grayf32 input image magick magick:rose -colorspace LinearGray -depth 32 rose.pfm # gbrp, gbrp9/10/12/14/16 work fine: ffmpeg -color_range full -color_trc linear -i rose.pfm -vf "format=gbrp, format=rgb48" rose.png # gbrpf32 creates unholy green abomination: ffmpeg -color_range full -color_trc linear -i rose.pfm -vf "format=gbrpf32, format=rgb48" rose.png ```
Traneptora
bonnibel and now finally found a bug thats definitely in ffmpeg itself lol
2023-12-02 03:28:40
https://trac.ffmpeg.org/ticket/10716
bonnibel
2023-12-02 03:29:40
thank you <3
Traneptora
2023-12-04 02:57:01
<@179701849576833024> for fpnge do you lock to paeth or west
veluca
2023-12-04 02:59:37
I don't remember what the default does, probably paeth
2023-12-04 02:59:54
There's also something that will select the best predictor per row which is not much slower
afed
2023-12-04 03:02:33
https://github.com/veluca93/fpnge/pull/19
Traneptora
2023-12-06 11:02:53
<@184373105588699137> how'd you hack JPEG XL into NUT btw?
Quackdoc
Traneptora <@184373105588699137> how'd you hack JPEG XL into NUT btw?
2023-12-06 11:06:25
using this patch with ffmpeg. ```patch diff --git a/libavformat/riff.c b/libavformat/riff.c index df7e9df31b..16e37fb557 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -34,6 +34,7 @@ * files use it as well. */ const AVCodecTag ff_codec_bmp_tags[] = { + { AV_CODEC_ID_JPEGXL, MKTAG('J', 'X', 'L', ' ') }, { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') }, { AV_CODEC_ID_H264, MKTAG('h', '2', '6', '4') }, { AV_CODEC_ID_H264, MKTAG('X', '2', '6', '4') }, ```
2023-12-06 11:06:45
after this ffmpeg will recognize it and mux/demux into most containers
Traneptora
2023-12-06 11:07:23
ah, okay
2023-12-06 11:07:43
how does it packetize the encoded stream?
2023-12-06 11:07:49
the encoder emits one AVPacket per image
2023-12-06 11:07:52
but idk how that happens
Quackdoc
2023-12-06 11:12:35
I can't remeber quite how it does it since I've been using the riff hack for years, it works with pretty much any image sequence, I've used it for qoi image sequences in the past
Traneptora
2023-12-06 11:21:26
iirc you were having issues with jxl inside nut tho, idr what they were tbh
Quackdoc
2023-12-06 11:25:07
yeah, right now decoding jxl from a video container, nut or mkv doesn't matter, something during decoding is messing with how ffplay or mpv determine the timestamps, here for instance is how mpv is reporting the video stats
Traneptora
2023-12-06 11:46:01
looks like an issue with pts
2023-12-06 11:46:37
may be a bug in the decoder
Quackdoc
2023-12-06 11:54:15
its not something i've taken the time to look into.
Traneptora
Quackdoc its not something i've taken the time to look into.
2023-12-06 11:59:49
test this for me
2023-12-06 11:59:55
```patch diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c index 002740d9c1..831b7a40f3 100644 --- a/libavcodec/libjxldec.c +++ b/libavcodec/libjxldec.c @@ -431,10 +431,8 @@ static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame) if (ctx->basic_info.have_animation) ctx->timebase = av_make_q(ctx->basic_info.animation.tps_denominator, ctx->basic_info.animation.tps_numerator); - else if (avctx->pkt_timebase.num) - ctx->timebase = avctx->pkt_timebase; else - ctx->timebase = AV_TIME_BASE_Q; + ctx->timebase = av_make_q(1, 1); continue; case JXL_DEC_COLOR_ENCODING: av_log(avctx, AV_LOG_DEBUG, "COLOR_ENCODING event emitted\n"); ```
Quackdoc
2023-12-07 12:23:52
it doesn't have seemed to change much? ill try setting that to 25fps and test a 25fps video
Traneptora test this for me
2023-12-07 12:52:40
yeah it seems like setting the fps manually using `ctx->timebase = av_make_q(1, 25);` mpv will play it back perfectly fine. seeking is broken however for some reason
2023-12-07 12:57:45
removing the line out right seems to allow for seeking, ofc now with pts issues
Traneptora
Quackdoc yeah it seems like setting the fps manually using `ctx->timebase = av_make_q(1, 25);` mpv will play it back perfectly fine. seeking is broken however for some reason
2023-12-07 01:35:36
I think I figured it out
2023-12-07 01:36:29
2023-12-07 01:37:56
basically: if the container has PTS info (which it always will), use it
2023-12-07 01:37:58
if not, use 1fps
2023-12-07 01:38:09
as a fallback
Quackdoc
2023-12-07 01:38:57
i'll give this a try when I can, had to reboot to windows for a bit so cant test atm
bonnibel
2023-12-07 01:39:34
speaking of time stuff, i'm trying to use mergeplanes to bypass the grayf->gbrpf bug but it seems to nuke all the frame metadata. colour info etc i can easily restore with vf_setparams, but the duration of input images also gets set to 0 which means they dont get output... any idea on how to override that?
Traneptora
bonnibel speaking of time stuff, i'm trying to use mergeplanes to bypass the grayf->gbrpf bug but it seems to nuke all the frame metadata. colour info etc i can easily restore with vf_setparams, but the duration of input images also gets set to 0 which means they dont get output... any idea on how to override that?
2023-12-07 01:40:11
what if you use `-vf zscale=min=709,format=gbrpf32le`
bonnibel
2023-12-07 01:40:48
oo so then zscale reads the desired output format and does the conversion instead of swscale? good idea, ill try it right now
Traneptora
bonnibel oo so then zscale reads the desired output format and does the conversion instead of swscale? good idea, ill try it right now
2023-12-07 01:44:29
tried it, same issue. but I did successfully try `ffmpeg -i rose.pfm -vf libplacebo=format=gbrpf32le rose2.pfm`
2023-12-07 01:45:33
``` ffmpeg -color_primaries bt709 -color_trc linear -colorspace bt709 -i rose.pfm -vf libplacebo=format=gbrpf32le:color_trc=13 rose2.pfm ```
2023-12-07 01:45:34
this also works
bonnibel now i just need to figure out why vf_libplacebo chokes on grayf32 but not on gbrpf32 input and most of my ffmpeg woes will be gone
2023-12-07 01:46:17
what libplacebo version?
bonnibel
Traneptora tried it, same issue. but I did successfully try `ffmpeg -i rose.pfm -vf libplacebo=format=gbrpf32le rose2.pfm`
2023-12-07 01:46:30
this produces a pure black image for me
2023-12-07 01:46:51
my builds a few days old though ill grab latest and retest
Traneptora
2023-12-07 01:47:09
I just rebuilt libplacebo today
bonnibel
2023-12-07 01:48:36
omg it works now
2023-12-07 01:49:07
looks like the commit yesterday finally fixed it
Traneptora
bonnibel looks like the commit yesterday finally fixed it
2023-12-07 01:49:16
https://code.videolan.org/videolan/libplacebo/-/commit/52314e0e435fbcb731e326815d4091ed0ba27475 this one, yea
2023-12-07 01:50:29
ngl I prefer `UINT64_C(1)` over `1llu` but this does the job ig
bonnibel
2023-12-07 01:50:38
reading the discussion it looks like theyre still slightly shifting float values when they're not supposed to, but good enough for my purposes as its still better than the additional roundings etc from using 16 bit int in my pipeline
2023-12-07 01:51:15
my old solution was to just store the greyscale images as rgb float but that uh isnt possible anymore with how large my new dataset is haha
2023-12-07 01:55:19
now i can also encode the entire dataset as lossless jxl rather than pfm (since ffmpg jxl doesnt do float rgb, only do float grey), the savings \o/
2023-12-07 01:55:40
pretty fast to do too since e1 seems to produce the smallest filesize in this case when using faster decoding
Quackdoc
Traneptora
2023-12-07 06:36:55
interesting, it seems like ffplay will work fine, but mpv isn't playing nicely unless I use `--no-correct-pts` using `--container-fps-override=` doesnt make a difference, not sure if this is an issue with the patch or with mpv.
Traneptora
bonnibel now i can also encode the entire dataset as lossless jxl rather than pfm (since ffmpg jxl doesnt do float rgb, only do float grey), the savings \o/
2023-12-07 06:41:51
at the time I wrote the plugin, rgbf32le and rgbaf32le didn't exist
2023-12-07 06:41:56
I should probably add those now
Quackdoc interesting, it seems like ffplay will work fine, but mpv isn't playing nicely unless I use `--no-correct-pts` using `--container-fps-override=` doesnt make a difference, not sure if this is an issue with the patch or with mpv.
2023-12-07 06:42:52
with matroska or nut? I had mpv and ffplay both work okay but I tested nut, not mkv
Quackdoc
2023-12-07 06:44:32
ah yeah, I was testing MKV, nut works fine.
Traneptora
2023-12-07 06:44:56
mpv has its own matroska demuxer
Quackdoc
2023-12-07 06:48:28
interesting, I knew it had it's own demuxer for mkv but I didn't think that would case an issue, but indeed using demuxer=lavf worked fine
jonnyawsom3
bonnibel pretty fast to do too since e1 seems to produce the smallest filesize in this case when using faster decoding
2023-12-07 10:02:24
That's... Interesting... Lossless e1 uses a separate codepath, so I'd double check it's still actually lossless with faster decode just in case it's doing something weird
veluca
2023-12-07 10:29:43
I mean, faster-decoding is completely ignored by lossless-e1
jonnyawsom3
2023-12-07 12:44:55
Apparently not if they're right
veluca
2023-12-07 12:45:41
I certainly never wrote any logic to handle that flag xD
jonnyawsom3
2023-12-07 01:21:06
Hmm, no difference for me, although I didn't use a greyscale image
w
2023-12-15 03:53:14
r> jpegli rotation
2023-12-15 03:54:05
r> jpegli arw input
2023-12-15 03:59:01
libjxl still no tiff...
2023-12-15 03:59:14
trying to encode photos from camera and i'm having to jump through a billion hoops
jonnyawsom3
2023-12-15 04:13:06
It's already hard enough just trying to get uncompressed images out a camera, aside from the RAW itself which then needs pre-processing before JXL
w
2023-12-15 04:25:49
I plug it in > open up sony image viewer > export tif
2023-12-15 04:26:14
or plug it in > drag arw
2023-12-15 04:29:34
If the shot is fine, the raw doesn't need any preprocessing
Traneptora
w I plug it in > open up sony image viewer > export tif
2023-12-15 04:49:27
magick convert -depth 16 input.tiff output.png
2023-12-15 04:49:37
alternatively, ffmpeg
w
2023-12-15 04:49:57
Yeah that's what I did and it takes like 3 minutes per image
2023-12-15 04:50:13
Didn't need -depth 16 it seems to already do it
jonnyawsom3
w If the shot is fine, the raw doesn't need any preprocessing
2023-12-15 05:55:07
I meant debayering and such
Traneptora
2023-12-15 05:55:31
ye RAW itself still needs processing cause the actual data isn't pixel data
2023-12-15 05:55:43
you need some sort of camera-raw like adobe camera raw or ufraw or something
spider-mario
2023-12-15 08:21:25
there’s a libraw developer who gets a bit annoyed by such statements
2023-12-15 08:21:39
since, after all, it’s also true of JPEG files that the actual data isn’t pixel data
2023-12-15 08:22:14
conversely, raw files contain not just the data from each sensel, but some metadata as well
2023-12-15 08:22:49
to the point that at least Canon’s and Nikon’s raw development software produces images that look exactly like the in-camera JPEGs (but in potentially higher quality)
Quackdoc
2023-12-15 08:23:18
I just treat "RAW" as a marketing term
2023-12-15 08:23:37
so many formats and companies take extreme liberties with the word
spider-mario
Quackdoc I just treat "RAW" as a marketing term
2023-12-15 08:24:29
incidentally, that libraw developer also gets annoyed by the use of “RAW” in uppercase
2023-12-15 08:24:46
(“we don’t call the opposite COOKED” – paraphrased)
lonjil
spider-mario to the point that at least Canon’s and Nikon’s raw development software produces images that look exactly like the in-camera JPEGs (but in potentially higher quality)
2023-12-15 08:27:43
yeah, but there's no standard to do that, right? So it's still a bit different from JPEG where you can just use libjpeg and get a nice picture out.
Quackdoc
2023-12-15 08:28:20
what troy sobotka told us on the olive forums before he left was a pretty good take IMO ". This is in terms of things like blackmagic raw, prores raw, alexa raw > Because raw isn’t a thing. So it’s fair to call it raw. Unmassaged RGB primaries are most certainly “raw” Hence Yet Another Meaningless Garbage term.
2023-12-15 08:29:05
basically raw without any qualifier to define it is a meaningless term
spider-mario
lonjil yeah, but there's no standard to do that, right? So it's still a bit different from JPEG where you can just use libjpeg and get a nice picture out.
2023-12-15 08:30:50
I guess it depends on what you call “standard”; one could argue that whatever Canon produces from their own raw files should be the standard for those files
2023-12-15 08:30:53
but yeah, no public spec for that
Cacodemon345
2023-12-15 09:49:02
I honestly thought of raw as what cameras simply output what those saw according to their own interpretation/language without any processing whatsoever.
Quackdoc
2023-12-15 09:50:10
"raw" is whatever the implementer wants it to be, it sounds great at least xD
Traneptora
spider-mario since, after all, it’s also true of JPEG files that the actual data isn’t pixel data
2023-12-15 10:33:42
yea, but RAW files don't have a spec that tells you how to convert it to pixel data, right?
2023-12-15 10:33:58
like camera raw data is not a specified codec
2023-12-15 10:35:17
I'm aware that JPEG decoding isn't fully specified either but that's more of a quirk of the spec itself than a conceptual difference between JPEG and other image codecs
spider-mario
2023-12-15 10:35:19
Canon probably has something like that for their .CR2 and .CR3 (at the very least, “whatever DPP outputs”), Nikon for their .NEFs, etc. just as PNG has its spec and JPEG has its own
2023-12-15 10:35:24
but yeah, nothing public, AFAIK
Traneptora
2023-12-15 10:35:43
yea, in particular, .cr2 files are not designed a way to store pixel data
2023-12-15 10:35:59
they're designed as a way to store sensor data
2023-12-15 10:36:13
likewise, JPEGs are by design a way to store pixel data efficiently
w
2023-12-16 03:30:36
I thought RAW is an actual format
Quackdoc
2023-12-16 03:31:43
https://tenor.com/view/blunder-princess-bride-you-fool-gullible-gotcha-gif-14120688
w
2023-12-16 03:32:58
it's like BMP is to bitmap
2023-12-16 03:34:13
I'm otherwise stuck using Sony image edit then unless I want to pay for lightroom
2023-12-16 03:35:21
so that's why I at least ask for tif
2023-12-16 03:35:42
2gb tif files...
2023-12-16 04:04:09
```$ convert DSC00892_PSMS16.TIF DSC00892_PSMS16.TIF.png convert-im6.q16: Unknown field with tag 50341 (0xc4a5) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/985. convert-im6.q16: width or height exceeds limit `DSC00892_PSMS16.TIF' @ error/cache.c/OpenPixelCache/3909. convert-im6.q16: no images defined `DSC00892_PSMS16.TIF.png' @ error/convert.c/ConvertImageCommand/3229.```
2023-12-16 04:04:12
i'm owned
Traneptora
w ```$ convert DSC00892_PSMS16.TIF DSC00892_PSMS16.TIF.png convert-im6.q16: Unknown field with tag 50341 (0xc4a5) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/985. convert-im6.q16: width or height exceeds limit `DSC00892_PSMS16.TIF' @ error/cache.c/OpenPixelCache/3909. convert-im6.q16: no images defined `DSC00892_PSMS16.TIF.png' @ error/convert.c/ConvertImageCommand/3229.```
2023-12-16 05:09:58
what about `ffmpeg -i input.tif output.png`
w
2023-12-17 02:19:06
it works
2023-12-17 02:19:15
unfortunately all metadata is lost
2023-12-17 02:22:46
and when i try to ffmpeg rgb48 `fish: Job 1, 'ffmpeg -i DSC00892_PSMS16\ \(1\…' terminated by signal SIGKILL (Forced quit)` 😭
MSLP
2023-12-17 02:24:16
OOM killer?
sklwmp
2023-12-17 02:27:28
does libvips work any better?
w
2023-12-17 02:28:20
what tool uses libvips
sklwmp
2023-12-17 02:29:46
libvips has a CLI of its own, you can use `vips copy original.tif output.png` or `vips pngsave original.tif output.png` to see the options for each command just do `vips [command]` where [command] is the command, without any arguments
MSLP
2023-12-17 02:31:02
you can also try `vips jxlsave`
w
2023-12-17 02:46:37
unfortunately it also kills the metadata
2023-12-17 02:47:08
but doing copy jpg took like a few seconds while jxlsave took a minute and died after using more than 8gb
sklwmp
w unfortunately it also kills the metadata
2023-12-17 03:05:56
on stable vips, unfortunately yea, but on vips git master (and hopefully a future release), metadata is preserved pretty well
w but doing copy jpg took like a few seconds while jxlsave took a minute and died after using more than 8gb
2023-12-17 03:06:22
the jxl encoder could use some work, it's still a memory hog just like cjxl
w
2023-12-17 03:07:03
i built git master
2023-12-17 03:08:06
v8.4.2-4006-gd80ccd205
2023-12-17 03:09:43
would also like mozjpeg or jpegli...
MSLP
2023-12-17 03:13:50
you can also use `exiftool` to move metadata to image encoded with any method. It doesn't support icc profiles for jxl tho
2023-12-17 03:14:38
it needs `-m` option for raw jxl codestream
2023-12-17 03:14:45
<https://github.com/exiftool/exiftool/issues/230>
w
2023-12-17 03:15:29
<:AngryCry:805396146322145301>
2023-12-17 03:17:38
that's the one thing I wanted to avoid
sklwmp
w i built git master
2023-12-17 05:27:07
oh, then i dunno, metadata saving is fine for me
monad
2023-12-17 11:29:47
```cjxl -d 0 -e 1 death-and-life-gustav-klimt.ppm death-and-life-gustav-klimt.jxl JPEG XL encoder v0.10.0 26d32cab [AVX2,SSE4,SSE2] Encoding [Modular, lossless, effort: 1] Compressed to 1869826.2 kB (9.269 bpp). 42458 x 38011, 763.424 MP/s [763.42, 763.42], 1 reps, 20 threads.``` ```cjxl --streaming_input --streaming_output -d 0 -e 1 death-and-life-gustav-klimt.ppm death-and-life-gustav-klimt.jxl JPEG XL encoder v0.10.0 26d32cab [AVX2,SSE4,SSE2] Encoding [Modular, lossless, effort: 1] Fatal glibc error: malloc.c:4369 (_int_malloc): assertion failed: (unsigned long) (size) >= (unsigned long) (nb) Aborted (core dumped)```
w
2023-12-17 04:48:40
$20 to whoever can get me jpegli 240MP 16bit tif input with <2gb ram <10s on 4 cores
diskorduser
2023-12-17 04:58:42
240mp? Bruh
Traneptora
w $20 to whoever can get me jpegli 240MP 16bit tif input with <2gb ram <10s on 4 cores
2023-12-17 07:04:18
just use hydrium lol
2023-12-17 07:04:30
only takes png input tho
2023-12-17 07:04:40
unless you link to za library
MSLP
2023-12-17 07:14:45
would it be able to write exif too tho?
spider-mario
2023-12-17 07:43:32
you can losslessly add EXIF to an existing JPEG
2023-12-17 07:43:35
would be one way to do it
MSLP
w that's the one thing I wanted to avoid
2023-12-17 08:51:01
that was one thing w wanted to avoid, so that's why I'm asking
spider-mario
2023-12-17 09:36:14
oh
2023-12-17 09:36:20
why, though
2023-12-17 09:36:31
if it’s the UI, is exiv2 less painful?
Traneptora
MSLP would it be able to write exif too tho?
2023-12-17 09:37:57
no, it writes raw codestreams
MSLP
spider-mario if it’s the UI, is exiv2 less painful?
2023-12-17 09:46:03
Not sure, probably as-simple-as-possilble pipeline is needed. I think exiv2 supports only reading for all BMFF-based containers, so `exiftool` may be currently the only widespread option for repacking exiv in jxl, without re-encoding the image. Maybe a simple tool in libjxl that can add exif/xmp metadata (eg. having metadata extracted with exiv2 to a file), without transcoding would be useful.
w
2023-12-18 12:24:47
<:linusretire:707375442226708542>
2023-12-18 05:14:06
does cjxl/libjxl even copy metadata?
2023-12-18 05:14:27
I see `Brotli-compressed xml metadata: 494 compressed bytes` but have no idea how to read it
2023-12-18 05:14:33
nothing shows up in exiftool
2023-12-18 05:15:00
and there's nothing in the cjpegli output aswell
2023-12-18 05:20:46
oh looks like libjpeg-turbo/mozjpeg/cjpeg doesnt do it either
2023-12-18 05:35:04
I guess what I really need is jpegli as a library which I can build magick against
sklwmp
2023-12-18 05:46:58
you can do that, i don't even rebuild magick, i just do LD_PRELOAD like ```bash LD_PRELOAD=/home/username/dev/libjxl/build/lib/jpegli/libjpeg.so.8 magick original.tif -quality 90 test.jpg ```
w nothing shows up in exiftool
2023-12-18 05:47:34
does `magick identify -verbose` work?
w
2023-12-18 06:19:06
has stuff but not the original metadata
sklwmp you can do that, i don't even rebuild magick, i just do LD_PRELOAD like ```bash LD_PRELOAD=/home/username/dev/libjxl/build/lib/jpegli/libjpeg.so.8 magick original.tif -quality 90 test.jpg ```
2023-12-18 06:29:08
sweet that works, also the resolution complaint went away after building im7
2023-12-18 06:29:41
i just overwrote the installed libjpeg with the jpegli ones
2023-12-18 07:39:02
looks like imagemagick doesnt copy all the tags either... but at least I can tif to jpegli with it
sklwmp
2024-01-03 10:11:31
I just realized that this applies to Floorp too... it's really annoying when I just want to "Open image in new tab" and it suddenly downloads the JXL file
jonnyawsom3
2024-01-03 11:33:41
I had to fix that with an extension in waterfox
sklwmp
2024-01-03 03:26:47
What extension?
jonnyawsom3
2024-01-03 03:28:32
https://github.com/Rob--W/open-in-browser
_wb_
2024-01-07 10:16:03
Imo it's just bad UX that browsers do file type sniffing for jpeg/png/webp/avif but not for jxl because apparently just after it was added for avif, people decided that no more file type sniffing should be added to browsers because of security reasons.
username
_wb_ Imo it's just bad UX that browsers do file type sniffing for jpeg/png/webp/avif but not for jxl because apparently just after it was added for avif, people decided that no more file type sniffing should be added to browsers because of security reasons.
2024-01-08 03:55:28
I think the issue is entirely server side (atleast for firefox it is), I have checked the source code for Firefox/Gecko and I could not find any instances of it auto correcting mime types at all for any image format and it seems like the annoying auto download behavior happens because most servers hosting JXL files don't send them as "image/jxl" but instead as "application/octet-stream", take for example this http://demos.webmproject.org/webp/cmp/2022_10_04/comparisonfiles/subset1/small/JXL/08-2011._Panthera_tigris_tigris_-_Texas_Park_-_Lanzarote_-TP04.jxl url which works just fine in chromium and firefox/gecko because it actually sends the file over properly as "image/jxl".
2024-01-08 03:56:13
it seems like it's just an issue of a lot of web servers not understanding what .jxl fikes should be sent over as
2024-01-08 03:56:50
https://jpegxl.info/ has this problem as well
2024-01-08 04:09:59
Shopify's CDN servers seem to have the correct behavior. (these get served as a JXL in browsers that support it) https://magicholz.de/cdn/shop/files/rokr-The-Luminous-Globe-ST003-v2_400x.png?v=1699359962 https://kojimaproductions-store.com/cdn/shop/products/KJDST11710M240000_1_large.png?v=1695319286
diskorduser
2024-01-08 04:20:03
I opened the link in thorium. I get png.
username
2024-01-08 04:25:40
they end up as jxl for me in both browsers, it's just there is no direct url for the jxl version because all formats are served from the same url
diskorduser
2024-01-08 04:27:12
May be some problem with thorium Android or something
username
https://github.com/Rob--W/open-in-browser
2024-01-08 04:30:50
https://addons.mozilla.org/firefox/addon/content-type-fixer/ this extension works as well though annoyingly you can't set an override directly and can only do it after it's appeared in the log
_wb_
username I think the issue is entirely server side (atleast for firefox it is), I have checked the source code for Firefox/Gecko and I could not find any instances of it auto correcting mime types at all for any image format and it seems like the annoying auto download behavior happens because most servers hosting JXL files don't send them as "image/jxl" but instead as "application/octet-stream", take for example this http://demos.webmproject.org/webp/cmp/2022_10_04/comparisonfiles/subset1/small/JXL/08-2011._Panthera_tigris_tigris_-_Texas_Park_-_Lanzarote_-TP04.jxl url which works just fine in chromium and firefox/gecko because it actually sends the file over properly as "image/jxl".
2024-01-08 06:29:19
Of course it's the server's fault for not putting image/jxl in the response header when serving a jxl, but it's the browser's fault that it's not trying to open it anyway (like it does when a server sends any other image format without the correct response header).
jonnyawsom3
2024-01-08 12:40:45
I noticed when helping change a friend's NGINX config file. Their mine.types file is years out of date and heavily cherry picked. The octet stream would display for me, but image specific additions in the network inspector (such as previewing the file) wouldn't until I replaced the outdated mime.types file
sklwmp
username https://addons.mozilla.org/firefox/addon/content-type-fixer/ this extension works as well though annoyingly you can't set an override directly and can only do it after it's appeared in the log
2024-01-09 02:44:57
This is super useful too, thanks for sharing!
Traneptora
username I think the issue is entirely server side (atleast for firefox it is), I have checked the source code for Firefox/Gecko and I could not find any instances of it auto correcting mime types at all for any image format and it seems like the annoying auto download behavior happens because most servers hosting JXL files don't send them as "image/jxl" but instead as "application/octet-stream", take for example this http://demos.webmproject.org/webp/cmp/2022_10_04/comparisonfiles/subset1/small/JXL/08-2011._Panthera_tigris_tigris_-_Texas_Park_-_Lanzarote_-TP04.jxl url which works just fine in chromium and firefox/gecko because it actually sends the file over properly as "image/jxl".
2024-01-09 11:12:28
I discovered this issue when configuring my webserver. nginx doesn't include image/jxl in its default mimetype file
username
Traneptora I discovered this issue when configuring my webserver. nginx doesn't include image/jxl in its default mimetype file
2024-01-09 11:35:55
I wonder if they would accept a contribution/patch to add jxl to the default mime.types list? https://nginx.org/en/docs/contributing_changes.html There's a chance they could decline since image/jxl is still sitting on the IANA provisional media list, although the nginx folks might not care too much and accept it either way https://www.iana.org/assignments/provisional-standard-media-types/provisional-standard-media-types.xhtml
2024-01-09 11:45:16
also I have no clue how IANA operates or what the process for getting media types registered with it/them is like but why is image/jxl still not accepted/registered? is there some timespan that needs to pass or something?
2024-01-09 11:54:43
(relevant discussion from a few years ago): https://discord.com/channels/794206087879852103/794206170445119489/845019584230064168
MSLP
username also I have no clue how IANA operates or what the process for getting media types registered with it/them is like but why is image/jxl still not accepted/registered? is there some timespan that needs to pass or something?
2024-01-10 04:44:21
I'm too wondering how long the whole process takes. And how long it's been since IANA got full registration form (to be put in provisional list doesn't need full registration request, so the moment `image/jxl` appeared in provisional list may be some time before they got full registration request)
yurume
2024-01-10 05:41:49
> Accordingly, a provisional registration process is provided to support early assignment of media type names in the standards tree. A provisional registration MAY be submitted to IANA for standards-tree types. The only required fields in such registrations are the media type name and contact information (including the standards-related organization name).
2024-01-10 05:42:12
it seems that the formal registration *is* required, though that's about the only requirement
spider-mario
MSLP I'm too wondering how long the whole process takes. And how long it's been since IANA got full registration form (to be put in provisional list doesn't need full registration request, so the moment `image/jxl` appeared in provisional list may be some time before they got full registration request)
2024-01-10 09:45:46
errr I’m not fully sure we sent it 👀
2024-01-10 09:46:09
<@794205442175402004>, did we? I think it was the object of one of the ISO meetings, wasn’t it?
_wb_
2024-01-10 10:07:08
If we did, I wasn't in cc. Can someone do it? 18181-2 ED2 should be approved soon so it should be ok now.
JendaLinda
2024-01-23 05:15:27
I discovered a little inconsistency. cjxl assumes sRGB in untagged input files, however, the rendering intent depends on the file format. PNG and JPEG (lossless transcode) results in sRGB, Relative. GIF, Netpbm, JPEG (decoded to pixels) results in sRGB, Perceptual. I'm not sure if it actually makes any difference in sRGB. AFAIK rendering intent tells how to remap colors that are outside the target color space, but sRGB is the smallest color space in use.
2024-01-23 05:19:30
In any case, think the color space assumption should be consistent for all input formats.
Traneptora
JendaLinda I discovered a little inconsistency. cjxl assumes sRGB in untagged input files, however, the rendering intent depends on the file format. PNG and JPEG (lossless transcode) results in sRGB, Relative. GIF, Netpbm, JPEG (decoded to pixels) results in sRGB, Perceptual. I'm not sure if it actually makes any difference in sRGB. AFAIK rendering intent tells how to remap colors that are outside the target color space, but sRGB is the smallest color space in use.
2024-01-23 05:29:06
that's true - rendering intent is a hint to the CMS engine on how to map the gamut
2024-01-23 05:29:21
so if the colors are sRGB then it is unlikely that gamut mapping has to happen
2024-01-23 05:29:29
but I agree it should be the same
JendaLinda
2024-01-23 06:12:24
I might post an issue about this.
_wb_
Traneptora so if the colors are sRGB then it is unlikely that gamut mapping has to happen
2024-01-23 06:41:42
When printing an sRGB image, there are typically out of gamut colors since CMYK based printers do not cover all of sRGB. So it does matter in theory. I dunno if printing applications actually look at rendering intent, they might just ignore it and do something based on printer settings, but in principle they should be looking at this field.
lonjil
2024-01-23 07:29:30
displays with a gamut smaller than sRGB aren't exactly uncommon either, but such systems would not commonly have correct color calibration data to tell you that anyway.
Traneptora
2024-01-23 08:06:45
regardless, I do think it should be set to Relative for all of them, or Perceptual for all of them
2024-01-23 08:06:50
rather than one for some and one for the other
JendaLinda
_wb_ When printing an sRGB image, there are typically out of gamut colors since CMYK based printers do not cover all of sRGB. So it does matter in theory. I dunno if printing applications actually look at rendering intent, they might just ignore it and do something based on printer settings, but in principle they should be looking at this field.
2024-01-23 09:04:15
I forgot about printing, but that's an entirely different problem. Pictures must be created with printing in mind, otherwise the colors will be incorrect.
lonjil displays with a gamut smaller than sRGB aren't exactly uncommon either, but such systems would not commonly have correct color calibration data to tell you that anyway.
2024-01-23 09:09:06
Yes, these are just using sRGB and hoping for the best.
2024-01-23 09:23:28
Alright, I will create an issue about this, so the default intent should be the same for all untagged input files. Anyway, it seems that the rendering intent is not encoded as a single byte value in the jxl file. The same pixel data in different file formats resulted in jxl files of different size. That's how I discovered the discrepancy in the first place.
2024-01-23 09:26:11
I was wondering if it would be possible to change the rendering intent tag without reencoding the entire jxl file but it seems it won't be that easy.
_wb_
2024-01-23 09:36:28
looks like sRGB with kRelative is an all-default ColourEncoding so that will take only 1 bit while anything else requires at least one or two bytes
spider-mario
2024-01-23 09:45:43
perceptual requires a table that is tailored for the source gamut and often ends up being equivalent to relative anyway
2024-01-23 09:45:52
relative as default is probably good
JendaLinda
2024-01-23 10:05:44
I will open the issue tomorrow so we can keep track about it.
Traneptora
2024-01-24 10:32:10
Does anyone know how to configure nginx to check the accept header and send a different image depending on what is present?
veluca
2024-01-24 11:11:09
I did it once
2024-01-24 11:11:25
I don't really remember how, let me see if I still have it somewhere
2024-01-24 11:11:57
nope 😦
Quackdoc
2024-01-24 11:25:42
dont you use location directive for that?
veluca
2024-01-24 11:39:10
I remember it's not exactly hard
2024-01-24 11:39:18
but I don't remember how it's done at all
2024-01-24 11:39:26
and nginx config files are always a bit of a mystery
Traneptora
Quackdoc dont you use location directive for that?
2024-01-25 12:31:18
location directive lets you make rules based on the URL of the request
2024-01-25 12:31:34
not based on the accept headers
Quackdoc
2024-01-25 12:32:07
I thought it could do both hmmm
2024-01-25 12:32:54
probably map then
Traneptora
2024-01-25 12:33:17
ye, looks like it's a map directive
2024-01-25 12:39:02
```nginx map $http_accept $image_suffix { ~.*image/jxl.* .jxl; default ""; } ```
2024-01-25 12:40:08
and then ```nginx location /images { try_files $uri$image_suffix $uri; } ```
2024-01-25 12:40:09
or something of this form
yurume
2024-01-25 01:01:39
you will need a content negotiation, but nginx proper doesn't have a direct support for that (hence that hack)
2024-01-25 01:02:31
highly unlikely, but that mapping will be incorrect for `image/*,image/jxl;q=0` for example
Traneptora
2024-01-25 06:39:04
yea, looks like it doensn't actually support content negotation at all
2024-01-25 06:39:10
you just have to regex match the accept header
yurume highly unlikely, but that mapping will be incorrect for `image/*,image/jxl;q=0` for example
2024-01-29 06:23:37
what would be an actual regex that would support weird cases like this
2024-01-29 06:24:06
Supposing you only serve jxl and have a jpeg fallback
2024-01-29 06:24:18
not a whole myriad
2024-01-29 06:24:55
also how does content negotiation work with cloudflare caches and the like
_wb_
2024-01-29 06:34:58
I dunno about others, but in Cloudinary we only use the Accept header to figure out what the UA can decode, not to return the format they prefer.
Traneptora
2024-01-29 07:05:28
I think my best strategy atm for my own site is to not deal with content negotiation and instead use `<picture>` tags
2024-01-29 07:05:35
since currently I use nginx for static delivery, not apache
spider-mario
2024-01-29 07:07:52
yeah, I find it an overall more satisfactory option
2024-01-29 07:08:18
it also alleviates the issue of “when I save, it saves as webp”
2024-01-29 07:08:39
since the browser can in principle let the user choose which format to save (and from what I understand, there are extensions for that)
Traneptora
2024-01-29 07:10:19
it requires me to control the HTML though, which I do in this casae
_wb_
spider-mario it also alleviates the issue of “when I save, it saves as webp”
2024-01-29 07:10:21
For that it doesn't matter whether you use picture srcset or content negotiation: when you do "save as" it will request the image again without the usual accept headers, so you'll get a fallback jpeg if the server supports multiple formats.
Traneptora
2024-01-29 07:10:34
not necessarily
spider-mario
2024-01-29 07:10:37
oh, does it?
Traneptora
2024-01-29 07:10:47
some browsers if you do "save image as" may save directly from the browser cache
spider-mario
2024-01-29 07:10:56
(but what if you _do_ want to save as webp, then?)
_wb_
2024-01-29 07:10:58
Or at least at some point it worked like that in Chrome, not sure if it still does that
Traneptora
2024-01-29 07:11:02
something I do sometimes is rclick copy image link followed by opening a terminal and then "curl -O link"
2024-01-29 07:11:32
but at least on firefox iirc it just saves whatever the browser put in its cache
2024-01-29 07:11:35
to prevent a second request
_wb_
spider-mario (but what if you _do_ want to save as webp, then?)
2024-01-29 07:11:39
Yeah it's annoying, this is how I discovered that, I wanted to save the webp but got a jpeg
Traneptora
2024-01-29 07:12:43
for example, consider the following page: https://traneptora.com/404
2024-01-29 07:13:13
```html <!DOCTYPE html> <html> <head><title>404 Not Found</title></head> <body style="text-align: center;"> <h1>404 Not Found</h1> <h3>I can’t find them. There’s only soup.</h3> <picture> <source type="image/jxl" srcset="/images/soup.jxl"/> <source type="image/jpg" srcset="/images/soup.jpg"/> <img src="/images/soup.jpg"/> </picture> </body> </html> ```
2024-01-29 07:13:38
in my browser, which is a firefox fork that supports jxl, right click -> save image, will save soup.jxl
_wb_
2024-01-29 07:14:09
Also it depends on how the server is doing its selection of formats: e.g. YouTube does something funky to detect your browser and then just assumes stuff about it, but it will e.g. keep sending webp to Chrome even if you manually disable it in Chrome devtools
Traneptora
2024-01-29 07:14:19
this is without HTTP content negotiation btw
_wb_
2024-01-29 07:18:55
If the various sources are in the html like that, a browser could show a "save as" dialog that lets you pick which one you want to get. If it's via http content neg, it cannot know what's available but it could still offer a choice between "the image I already downloaded" and "refetch with Accept header set to pretend I don't support jxl/avif/webp"
Traneptora
2024-01-29 07:24:26
in theory it could, but it also doesn't
2024-01-29 07:24:30
at least my browser does not
spider-mario
2024-01-29 07:34:36
with <picture> and <source>, in principle, this sort of extension should be possible: https://chromewebstore.google.com/detail/save-image-as-type/gabfmnliflodkdafenbcpjdlppllnemd
2024-01-29 07:35:06
oh, wait, it says it’s open source, so it should be possible to check whether that’s how it currently does it
2024-01-29 07:35:36
https://github.com/image4tools/Save-Image-as-Type there it is
2024-01-29 07:36:44
seems to use a regexp to replace the extension in the url
2024-01-29 07:37:39
ah, no, it also has a conversion utility
2024-01-29 07:37:39
`canvas.toDataURL(`
Traneptora
2024-01-29 08:29:48
surprised it's not using `toBlobURL` or something
2024-01-29 08:29:55
`toDataURL` is wildly inefficient
2024-01-29 08:31:06
er wait
2024-01-29 08:31:17
`URL.createObjectURL(object)`
2024-01-29 08:31:57
`canvas.toBlob()` works
sklwmp
2024-01-30 01:43:08
Does anyone know an alternative File Explorer on Windows that can display JXL thumbnails? jxl-winthumb is a little slow (and the new jxl-oxide releases have wrong colors, see [#29](https://github.com/saschanaz/jxl-winthumb/issues/29))
afed
2024-01-30 01:58:59
older, non-jxl-oxide version should be faster, unfortunately the updates changed to not yet so optimized jxl-oxide (and not fully feature rich) it's good that there are alternative decoders, but as for typical usage it's a downgrade because even libjxl is not always fast enough for large or lossless images
sklwmp
2024-01-30 02:04:15
the last part rings quite true, i usually use jxl for lossless recompression of large tiffs
2024-01-30 02:04:19
for that use case, it is really quite slow
2024-01-30 02:04:46
i'd probably use lossy jxl more once adoption gets better
Traneptora
afed older, non-jxl-oxide version should be faster, unfortunately the updates changed to not yet so optimized jxl-oxide (and not fully feature rich) it's good that there are alternative decoders, but as for typical usage it's a downgrade because even libjxl is not always fast enough for large or lossless images
2024-01-30 02:39:31
jxl-oxide has gotten a number of fairly good perf improvements recently
afed
2024-01-30 02:43:41
yeah, but i mean if even the much highly optimized libjxl is slow for large images, using something even slower to decode it is a noticeable downgrade for typical usage
2024-01-30 02:46:58
i understand that jxl-oxide is easier to maintain for a rust-based decoder, but from the user side it's not an improvement
sklwmp
2024-01-31 05:41:44
any recommendations for an image viewer that can do multi-threaded decode of jxl files? imageglass, gwenview, etc. all seem way slower than djxl, but if i disable multi-threading on djxl it seems to be on par
afed
2024-01-31 05:45:22
not sure if it's faster, but multithreading is supported https://github.com/nomacs/nomacs
sklwmp
2024-01-31 07:33:35
thanks! definitely *feels* faster
Traneptora
2024-01-31 05:35:20
~~mpv~~
Fedora
2024-02-04 06:48:33
Not sure if this is the right channel, but does anyone know why 70 % JPEG quality (3.14 MB) corresponds to roughly 36 % JPEG XL quality (3.16 MB) in Lightroom? I kinda expected 70 % JPEG XL quality to give me the same file size for more quality than 70 % JPEG quality, but the scale seems way off.
2024-02-04 06:51:49
_wb_
2024-02-04 07:01:25
Quality is not a percentage.
2024-02-04 07:04:15
Are you comparing the lightroom jpeg scale to the lightroom jxl scale? If so, then it's indeed a bit strange that they don't match very well...
Fedora
2024-02-04 07:24:23
2024-02-04 07:24:25
Yep. Since JPEG 60 % was good enough for me, I tried to export JPEG XL with 60 % as well, expecting a similar if not better perceived image quality at less storage space. Lightroom instead exported JPEG XL with a file size that far exceeds what JPEG does. The image quality was obviously there, but not at the file size I expected. So I tried different JPEG XL quality settings until the file sizes roughly match, and am a bit confused why the JPEG quality doesn't align with the JPEG XL quality setting at all.
_wb_
2024-02-04 07:34:24
I wonder what kind of scale they use
Oleksii Matiash
Fedora
2024-02-04 07:54:09
Not answering your question, but want to mention the thing that was kind of suprise for me - 16 bpp jxls are (can be) smaller than 8 bpp at the same quality level set
Fedora
2024-02-04 07:55:10
Huh? Okay...
_wb_
2024-02-04 08:04:34
For lossy, bpp is just metadata, doesn't make a difference in the actual data. But giving the encoder 16-bit data can be good, then it's not wasting bits on trying to keep the slight quantization errors of 8-bit encoding...
spider-mario
2024-02-04 08:07:41
yep, same with AAC (at least with fdk-aac) and 16- vs. 24-bit input in my experience
Traneptora
2024-02-04 08:08:02
higher precision input data allows the predictors to be more accurate
2024-02-04 08:08:14
for real world content
spider-mario
2024-02-04 08:09:04
but yeah, all in all, there is no reason to expect quality scales to match
Traneptora
2024-02-04 08:09:33
~~just have no quality option~~
spider-mario
2024-02-04 08:09:42
JPEG quality scales are arbitrary to begin with, as evidenced by the fact that various encoders have different scales
2024-02-04 08:10:31
if JXL tried to match either of them, it would not match the others
2024-02-04 08:10:53
(and actual lossless encoding would be outside of the scale)
lonjil
2024-02-04 08:11:03
Anime piracy often uses 10-bit HEVC for content that was originally 8 bit. Supposedly the quality ends up better vs file size.
spider-mario
2024-02-04 08:11:59
oh, yeah, I’ve heard about that too
2024-02-04 08:12:13
reportedly, that was also true with H.264, but 10-bit decoding was less widespread for H.264
_wb_
2024-02-04 08:20:43
Don't forget that 10-bit YCbCr is basically 9-bit RGB, even a little less if they use "tv range" YCbCr...
Traneptora
lonjil Anime piracy often uses 10-bit HEVC for content that was originally 8 bit. Supposedly the quality ends up better vs file size.
2024-02-04 08:47:42
H.264 at 10-bit can compress more efficiently than 8bit even for 8bit src because it gives the encoder more fudge room
2024-02-04 08:48:02
1 lower order bit becomes 3
lonjil
2024-02-04 08:48:09
Mm
Traneptora
2024-02-04 08:48:30
it also relied on an encoder which had a good psychovisual model
2024-02-04 08:48:40
which x264 does
2024-02-04 08:48:45
and x265 doesn't
2024-02-04 08:49:08
I find minimal reason to use x265 over x264 in practice
_wb_
2024-02-04 08:53:53
A good encoder for an old format is often better than a mediocre encoder for a newer format. See e.g. JXR.
spider-mario
2024-02-04 08:54:48
how mediocre is x265 still, by now?
2024-02-04 08:55:15
did they just drop x264’s psychovisual model for no good reason or was there one why they couldn’t practically keep it?
lonjil
2024-02-04 08:58:07
I wanna know why video people seem to love objective metrics so much. x264 got so good, in no small part from one dude just eyeballing it. Meanwhile both MPEG and AOM got people still using PSNR and SSIM.
spider-mario
2024-02-04 08:59:32
my guess would be because it’s easier to run various calculations and pretend that it makes the results “objective” than it is to critically assess a bunch of material
2024-02-04 09:00:49
it’s objective in the sense that no one would agree, therefore it doesn’t favour any one person’s opinion
Traneptora
2024-02-04 09:01:30
XYB was largely jyrki eyeballing iirc
spider-mario
2024-02-04 09:01:33
it’s a “fine, then no one will be happy” solution to the problem of slight interpersonal disagreements
Traneptora
2024-02-04 09:01:50
never forget the best x265 codeblock
2024-02-04 09:01:56
```cpp if (p->bLossless) { p->rc.rateControlMode = X265_RC_CQP; p->rc.qp = 4; // An oddity, QP=4 is more lossless than QP=0 and gives better lambdas p->bEnableSsim = 0; p->bEnablePsnr = 0; } ```
2024-02-04 09:02:09
<:kek:857018203640561677>
spider-mario
2024-02-04 09:02:12
… what
2024-02-04 09:02:29
is that true in general?
2024-02-04 09:02:42
as of 2024?
Kampidh
2024-02-04 09:49:06
IIRC, adobe lossy jxl exports are not in XYB except for the hdr ones https://discord.com/channels/794206087879852103/803574970180829194/1107970567241486398 which may explain bigger filesize
veluca
Traneptora XYB was largely jyrki eyeballing iirc
2024-02-04 09:49:06
yup 😄
spider-mario
2024-02-04 09:52:53
that was a while ago, I think we later had an exchange about what `uses_original_profile` means (unless I’m misremembering?)
2024-02-04 09:53:02
it’s likely they’ve since fixed it
Kampidh
2024-02-04 10:01:04
oh they fixed it?
Traneptora
spider-mario as of 2024?
2024-02-04 10:24:54
https://bitbucket.org/multicoreware/x265_git/src/74abf80c70a3969fca2e112691cecfb50c0c2259/source/encoder/encoder.cpp#lines-3711
spider-mario
2024-02-04 10:26:05
I meant more like “is the comment true”
Traneptora
2024-02-04 10:26:40
It's very perplexing
2024-02-04 10:27:04
considering "more lossless" isn't a thing
gb82
lonjil Anime piracy often uses 10-bit HEVC for content that was originally 8 bit. Supposedly the quality ends up better vs file size.
2024-02-04 11:17:16
for AVIF, this is the same - 8-bit AVIFs are usually worse than 10-bit AVIFs in fidelity per bit
Traneptora
2024-02-04 11:49:19
this is in part because precision is a fundemental part of the spec
2024-02-04 11:49:33
for lossless jxl modular, it just encodes integers as-is
2024-02-04 11:50:13
since the residuals are just fed to an entropy coder it doesn't really have a size cap beyond the 32-bit integer cap of the entropy coder
2024-02-04 11:50:24
whether they started as 12 or 8bit doesn't make much difference
2024-02-04 11:50:38
for lossy it's all floats internally anyway so bit depth is just metadata
Fedora
Kampidh IIRC, adobe lossy jxl exports are not in XYB except for the hdr ones https://discord.com/channels/794206087879852103/803574970180829194/1107970567241486398 which may explain bigger filesize
2024-02-05 12:20:15
So what's the best way to encode a jxl image currently? Lightroom can't export to OpenEXR, so that leaves me with png and tiff. cjxl doesn't support tiff, so png it is?
Oleksii Matiash
Traneptora I find minimal reason to use x265 over x264 in practice
2024-02-05 08:06:02
I compared x264 to x265 few times, and every time it appeared that 264 compression tradeoffs are more pleasant for me than 265, as 265 tends to blur low contrast details\textures, while 264 tries to more or less save it
sklwmp
2024-02-06 03:57:37
https://x.com/dm4uz3/status/1754643509879943448?s=20 Does Safari really have a minimum size to decode images?
2024-02-06 03:58:19
specifically this reply
username
2024-02-06 03:59:37
yeah it's true
2024-02-06 03:59:59
same thing happens to tiny WebPs as well
_wb_
2024-02-06 04:02:16
is that the issue? can someone file a bug report? seems like something that should be trivial to fix
jonnyawsom3
2024-02-06 04:12:08
It was mentioned here long ago when it was discovered, but I don't think anything ever came of it
username
2024-02-06 04:15:27
probably because I assume no one reported it to the proper place(s). Although I do wonder why this is even a problem in the first place? could have been something done on purpose back before formats that could naturally make files this small came to be added
Traneptora
2024-02-06 06:37:52
I think it was a sanity check to prevent random 404 responses from being sent to the decoder
2024-02-06 06:37:56
but that is just a guess
_wb_
2024-02-06 08:39:17
It would be funny if they assumed that no real image would be smaller than 48 bytes. In PNG/JPEG that is true.
afed
2024-02-06 08:41:29
but the smallest gifs have been used quite extensively
_wb_
2024-02-06 08:51:10
Safari doesn't choke on 1-pixel GIFs, I assume? Maybe it's something specific with how they feed modern bitstreams to their decoders...
lonjil
2024-02-06 09:19:08
So far I've managed to make jxl_from_tree produce invalid jxl files 😄
2024-02-06 09:22:23
guess I'm violating some invariant when setting a frame to be reference only...
sklwmp
2024-02-10 03:34:00
streaming encode is currently only for pnm, right? so i guess i have to wait for libvips to support it or something
jonnyawsom3
2024-02-10 05:27:18
ppm is for the streaming input, the encode itself should still be streaming but obviously has less of an effect on memory
_wb_
2024-02-10 05:33:52
streaming input is not _super_ important — the main issue with lossless memory consumption was that it was using something like 100 bytes per pixel before — which is a lot if the image is large. With streaming encode it only uses something more or less proportional to the number of threads (and nb of channels, I guess).
Jyrki Alakuijala
Fedora Yep. Since JPEG 60 % was good enough for me, I tried to export JPEG XL with 60 % as well, expecting a similar if not better perceived image quality at less storage space. Lightroom instead exported JPEG XL with a file size that far exceeds what JPEG does. The image quality was obviously there, but not at the file size I expected. So I tried different JPEG XL quality settings until the file sizes roughly match, and am a bit confused why the JPEG quality doesn't align with the JPEG XL quality setting at all.
2024-02-19 02:45:19
There is adobe jpeg quality and libjpeg jpeg quality. Adobe's 'save for web' quality 60 is about libjpeg quality 86. Also somewhat similar to quality 8 when save without 'save for web'. JPEG XL uses libjpeg quality when used with the lossy quality number that goes up to 99 in JPEG XL.
Yaywalter
2024-02-20 12:27:33
Might be a stretch to call this a *tool*, but I guess this would be the place to share this nonsense that I slapped together... https://github.com/yaywalter/Random-Image-Rumble
Demiurge
Jyrki Alakuijala There is adobe jpeg quality and libjpeg jpeg quality. Adobe's 'save for web' quality 60 is about libjpeg quality 86. Also somewhat similar to quality 8 when save without 'save for web'. JPEG XL uses libjpeg quality when used with the lossy quality number that goes up to 99 in JPEG XL.
2024-02-20 09:30:06
It doesn't go up to fractional values like 99.99?
Jyrki Alakuijala
2024-02-21 11:57:55
Guetzli goes to 110
_wb_
2024-02-21 02:39:26
That feels weird to me. 100 should be mathematically lossless.
jonnyawsom3
2024-02-21 02:59:01
That's normal Jpeg though, so there is no lossless
_wb_
2024-02-21 03:32:53
Technically the 1992 jpeg spec does have lossless modes too, but yeah.
jonnyawsom3
2024-02-21 03:43:40
Yeah
spider-mario
2024-02-21 04:05:12
and 12-bit and arithmetic coding, but…
jonnyawsom3
2024-02-21 04:21:52
I still feel bad for the one guy who converted all his photos into arithmetic jpegs and now can't JXL them
spider-mario
2024-02-21 04:25:12
jpegtran can probably undo that
2024-02-21 04:26:35
yes
2024-02-21 04:26:37
(just tried)
2024-02-21 04:27:01
not passing `-arithmetic` reverts to huffman
_wb_
2024-02-21 04:27:30
Yes. There is no jpeg bitstream reconstruction but jxl can still represent the image data of arithmetically coded jpegs perfectly. Probably the same is true for 12-bit ones, but that will be trickier to actually pull off.
MSLP
Jyrki Alakuijala Guetzli goes to 110
2024-02-21 05:02:33
Classic https://youtu.be/4xgx4k83zzc 😆
CrushedAsian255
spider-mario not passing `-arithmetic` reverts to huffman
2024-02-21 10:28:05
wait why does the arithmetic jpeg smaller jxl
2024-02-21 10:28:33
``` arithmetics: 118kb huffman. : 146kb jpeg xl. : 131kb ```
jonnyawsom3
2024-02-21 10:58:58
Reconstruction metadata probably
CrushedAsian255
2024-02-22 05:05:57
Is there a way to tell cjxl not to add that?
Yaywalter
2024-02-22 05:16:44
I think so, with --jpeg_store_metadata 0
pixelart_india
2024-02-22 10:16:25
<#803663417881395200>
CrushedAsian255
2024-02-22 10:40:43
This is <#803663417881395200> though
yoochan
CrushedAsian255 wait why does the arithmetic jpeg smaller jxl
2024-02-22 10:45:27
which encoder do you use to make arithmetic jpeg ?
Oleksii Matiash
yoochan which encoder do you use to make arithmetic jpeg ?
2024-02-22 10:58:59
Jpegtran can convert between AC and Huffman
CrushedAsian255
yoochan which encoder do you use to make arithmetic jpeg ?
2024-02-22 12:25:08
Jpegtran
yoochan
2024-02-22 08:46:47
Thanks everyone
JendaLinda
2024-02-27 10:16:57
I've noticed cjxl now accepts jxl input which is appreciated. However, the bitdepth information is not carried from the source jyl file to the target jxl file. In fact, all input jxl files are converted to 32bit float, including the lossless ones.
sklwmp
2024-02-27 11:41:13
I think that's because libjxl decodes jxl files just the same as any other like png, ppm, etc. into pixel data. So the encoder knows nothing about bit depth, pallette, or whatever, it only has the raw pixel data, which I believe is 32bit float internally. The encoder decides how to optimize from there.
2024-02-27 11:41:34
AFAIK only JPEG files are treated specially since they can be losslessly recompressed.
JendaLinda
2024-02-27 12:19:25
This is not true, the bit depth, either 8 bit or 16 bit, is carried from PNG or PPM to target JXL.
jonnyawsom3
2024-02-27 12:45:12
It was attempted to be fixed before https://github.com/libjxl/libjxl/pull/2591
JendaLinda
2024-02-27 12:55:35
As far I can tell, the fix doesn't work in the current build.
sklwmp
JendaLinda This is not true, the bit depth, either 8 bit or 16 bit, is carried from PNG or PPM to target JXL.
2024-02-27 01:03:00
Ah, good to know, thanks!
lonjil
2024-02-29 11:39:33
Is there any way to disable streaming output when using a speed that enables it by default in cjxl?
jonnyawsom3
2024-02-29 11:40:17
https://github.com/libjxl/libjxl/issues/3291
afed
2024-02-29 11:40:53
`unrelated to 1.0` <:FeelsSadMan:808221433243107338>
veluca
2024-02-29 11:48:02
streaming output is not enabled by default
2024-02-29 11:48:16
what is enabled by default is tiling the image in 2k x 2k buffers
lonjil
2024-02-29 11:49:52
ok you know what the more I learn about the new streaming stuff and defaults the more confused I get lol
afed
2024-02-29 11:53:27
so it's streaming input is enabled by default and output should be enabled separately, then what does streaming output gives if enabled, memory saving?
jonnyawsom3
2024-02-29 11:55:09
Actually you're still wrong xD
2024-02-29 11:56:54
Streaming Encoding: Enabled by default, 2048x2048 buffers Streaming Input: Loads the buffers from the image as required instead of loading the entire image at once Streaming Output: Writes the JXL file as groups finish encoding instead of soring it in memory and writing when finished
afed
2024-03-01 12:01:15
hmm, I thought if it's a supported format like ppm, then streaming input is also enabled by default
veluca
2024-03-01 12:07:04
nope
afed
2024-03-01 12:12:39
so that's even more variations for testing <:FeelsReadingMan:808827102278451241>
2024-03-01 12:15:23
and the buffer size is configurable, because I saw some options for benchmark_xl?
veluca
2024-03-01 12:16:20
it's configurable but configuring it will do nothing for now 😛
tufty
2024-03-03 11:54:23
vipsdisp 3 is out now, includes libjxl 0.10.1 https://github.com/jcupitt/vipsdisp/releases
2024-03-03 11:55:32
video demo here https://youtu.be/KSoBkO2_HtE it's almost a useful tool now heh
jonnyawsom3
2024-03-10 09:47:22
Hmm, I think `--output_extra_channels` on djxl is broken, either that or I'm not using it correctly
2024-03-10 09:48:17
```djxl suz-multichannel-800px.jxl --output_extra_channels multichannel.png JPEG XL decoder v0.10.2 e148959 [AVX2,SSE2] Decoded to pixels. 800 x 450, 11.979 MP/s [11.98, 11.98], , 1 reps, 16 threads.``` Only gives 1 PNG file
spider-mario
2024-03-10 09:54:00
are you sure the jxl file _has_ extra channels?
2024-03-10 09:54:22
I don’t know if `jxlinfo` is supposed to say anything about them, but it doesn’t
username
2024-03-10 09:55:07
?
spider-mario
2024-03-10 09:55:29
it’s not what I get with the one from discord
2024-03-10 09:55:41
oops, one second
2024-03-10 09:56:00
right, if I run jxlinfo on the wrong jxl file, it’s not going to work
2024-03-10 09:56:05
sorry about that
2024-03-10 09:59:02
it seems that somehow, `djxl` is not seeing them
2024-03-10 09:59:26
```patch diff --git a/tools/djxl_main.cc b/tools/djxl_main.cc index b739fa2de..909209f3b 100644 --- a/tools/djxl_main.cc +++ b/tools/djxl_main.cc @@ -600,9 +600,11 @@ int main(int argc, const char* argv[]) { fprintf(stderr, "Encode failed\n"); return EXIT_FAILURE; } + fprintf(stderr, "num_extra_channels = %zu\n", encoded_image.extra_channel_bitstreams.size()); size_t nlayers = args.output_extra_channels ? 1 + encoded_image.extra_channel_bitstreams.size() : 1; + fprintf(stderr, "nlayers = %zu\n", nlayers); size_t nframes = args.output_frames ? encoded_image.bitstreams.size() : 1; for (size_t i = 0; i < nlayers; ++i) { for (size_t j = 0; j < nframes; ++j) { @@ -611,6 +613,7 @@ int main(int argc, const char* argv[]) { : encoded_image.extra_channel_bitstreams[i - 1][j]); std::string fn = Filename(filename_out, extension, i, j, nlayers, nframes); + fprintf(stderr, "Filename(\"%s\", \"%s\", /*layer_index=*/%zu, /*frame_index=*/%zu, /*nlayers=*/%zu, /*nframes=*/%zu) = \"%s\"\n", filename_out.c_str(), extension.c_str(), i, j, nlayers, nframes, fn.c_str()); if (!jpegxl::tools::WriteFile(fn, bitstream)) { return EXIT_FAILURE; } ```
2024-03-10 09:59:38
```console $ tools/djxl .../suz-multichannel-800px.jxl --output_extra_channels multichannel.png JPEG XL decoder v0.10.2 05afcb368 [AVX2,SSE4,SSE2] Decoded to pixels. num_extra_channels = 0 nlayers = 1 Filename("multichannel.png", ".png", /*layer_index=*/0, /*frame_index=*/0, /*nlayers=*/1, /*nframes=*/1) = "multichannel.png" 800 x 450, 12.933 MP/s [12.93, 12.93], , 1 reps, 32 threads. ```
jonnyawsom3
2024-03-10 10:00:27
Weird...
spider-mario
2024-03-10 10:02:13
I suspect there’s a good chance that this is a regression, maybe we can find a revision where it worked and bisect from there
2024-03-10 10:02:45
potentially a good starting point could be when that code was introduced
jonnyawsom3
2024-03-10 10:05:47
I'll write up an issue quickly
2024-03-10 10:09:54
https://github.com/libjxl/libjxl/issues/3407
spider-mario
2024-03-10 10:11:34
… I’m actually unable to find a revision where it worked
2024-03-10 10:11:45
not sure if I’m missing something obvious too
2024-03-10 10:13:34
(I’ve only tried revisions that encompass `djxl_ng`, not the legacy `djxl` from before mid-2022 which used the internal API)
Kampidh
2024-03-10 11:20:53
I made that image with libjxl 0.7.0 during testing in krita. In the end we decided not to add multi channel capabilities though, and focused on multi layer capabilities instead. https://invent.kde.org/graphics/krita/-/merge_requests/1795
2024-03-10 11:21:22
soo, can't confirm it opened normally on latest 0.10+
_wb_
2024-03-11 09:16:45
Well if jxlinfo sees it but djxl doesn't, then I guess the bug is not in libjxl itself but in `extras/dec/jxl.cc` somehow not properly putting the extra channels in the ppf