Extend JXL support: saving in that format. #9

Closed
opened 2023-04-10 21:28:15 -07:00 by schrmh · 3 comments

It looks like imlib2 can only open JXL but not save to it (according to https://github.com/resurrecting-open-source-projects/scrot/issues/273#issuecomment-1502074636 but I grepped through the source code a bit and the ChangeLog doesn't mention a saver as well.)

It would be nice if imlib2 supported saving to JXL since a lot of of projects use this library and JXL can bring immense savings of over 50% compared to PNG, at least when it comes to desktop screenshots (I run that command on thousands of PNG files: cjxl -q 100 -m 1 -e 9 --brotli_effort 11 -E 3 -I 100 -g 3 -j 1).

It looks like imlib2 can only open JXL but not save to it (according to https://github.com/resurrecting-open-source-projects/scrot/issues/273#issuecomment-1502074636 but I grepped through the source code a bit and the ChangeLog doesn't mention a saver as well.) It would be nice if imlib2 supported saving to JXL since a lot of of projects use this library and JXL can bring immense savings of over 50% compared to PNG, at least when it comes to desktop screenshots (I run that command on thousands of PNG files: `cjxl -q 100 -m 1 -e 9 --brotli_effort 11 -E 3 -I 100 -g 3 -j 1`).
Owner

Right, there is no jxl saver. Maybe some day one turns up :)

Right, there is no jxl saver. Maybe some day one turns up :)
Author

Could this be of any use for a potential saver: https://github.com/alistair7/imlib2-jxl?
I found a mention to that within https://github.com/libjxl/libjxl/blob/main/doc/software_support.md

Could this be of any use for a potential saver: https://github.com/alistair7/imlib2-jxl? I found a mention to that within https://github.com/libjxl/libjxl/blob/main/doc/software_support.md
kw referenced this issue from a commit 2023-04-30 11:05:19 -07:00
Owner

Done.

To set non-default quality/compression parameters you'll have to use (similarly to other savers)
imlib_image_attach_data_value("quality", NULL, QUALITY, NULL);
imlib_image_attach_data_value("compression", NULL, EFFORT, NULL);
where QUALITY is in (0-100), more or less same as cjxl -q QUALITY, maps to jxl "distance" (15-0),
and EFFORT is in (1-9), same as cjxl -e EFFORT, default 7.

These parameters can be set when using imlib2_conv with like
imlib2_conv -i quality QUALITY -i compression EFFORT image.png image.jxl

Done. To set non-default quality/compression parameters you'll have to use (similarly to other savers) imlib_image_attach_data_value("quality", NULL, QUALITY, NULL); imlib_image_attach_data_value("compression", NULL, EFFORT, NULL); where QUALITY is in (0-100), more or less same as cjxl -q QUALITY, maps to jxl "distance" (15-0), and EFFORT is in (1-9), same as cjxl -e EFFORT, default 7. These parameters can be set when using imlib2_conv with like imlib2_conv -i quality QUALITY -i compression EFFORT image.png image.jxl
kw closed this issue 2023-05-02 00:13:36 -07:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: old/legacy-imlib2#9
No description provided.