resurrecting-open-source-projects / scrot

SCReenshOT - command line screen capture utility
Other
495 stars 49 forks source link

Support for JXL (JPEG XL) #273

Closed schrmh closed 1 year ago

schrmh commented 1 year ago

It is supported by Qt and GTK, images viewers can display it and GIMP and Krita can edit it. The only missing piece for the GNU/Linux desktop here is the support by screenshot capturing tools.

Currently I convert every new screenshot by using inotify to run a script that converts my PNG screenshots to JXL by making use of cjxl (cjxl -q 100 -m 1 -e 9 --brotli_effort 11 -E 3 -I 100 -g 3 -j 1). With that I got JXL files that were about 47% the size the PNG originals had. (I created those PNG files with xfce4-screenshooter before. For PNG images generated by scrot I haven't finished testing yet but could deliver a percentage on a few thousand files tomorrow or so and edit this post then. From the few it converted so far it looks like it's not worse). Edit: for images created by scrot it looks slightly better (but could also be due to switching to cjxl 0.8.1. I used 0.7 before): 44.16% of PNG on average after 3835 images.

N-R-K commented 1 year ago

Hi,

scrot doesn't do the image encoding itself, it's done via imlib2. imlib2 has loader for jxl but doesn't have a saver yet. You'll have to open an issue on imlib2's repo for it.

Once imlib2 adds a jxl saver, scrot should be able to save jxl files without needing any change. (e.g scrot shot.jxl will work).

schrmh commented 1 year ago

Thanks, any idea why this is under "old" there? »Old code that is mostly for reference/archive purposes«

Edit: Once imlib2 supports saving, would you consider to mention JXL support in the README and the man page? This would give the format some exposure which it deserves IMO.

N-R-K commented 1 year ago

Currently I convert every new screenshot by using inotify to run a script that converts my PNG screenshots to JXL by making use of cjxl

FYI, you can just use scrot's -e option (with the $f specifier) instead of messing with inotify.

any idea why this is under "old" there?

I don't keep up with enlightenment's development, so can't answer that. (But I can tell you that the library is being maintained, in case you're worried about that).

Anyways, closing this since it's out of scrot's control and is an imlib2 issue.

N-R-K commented 1 year ago

Update: jxl saver was added to imlib2 v1.11.1. So if you have this version (or later) of imlib2 installed then you can just run scrot shot.jxl or scrot --format jxl - to take jxl screenshots.

Caveat: scrot doesn't expose any way to set the "compression" setting for imlib2. So currently all jxl images will just use the default compression level. See https://github.com/resurrecting-open-source-projects/scrot/issues/290.

schrmh commented 1 year ago

Thanks, I did not get a notification from the issue from imlib2's repo for some reason so I appreciate the follow up.