-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to import JXL images #6367
base: dev
Are you sure you want to change the base?
Conversation
@xiota Thanks for your contribution! 👍 There seem to be some (error) conditions under which |
@Floessie Thanks for letting me know. I added a couple lines to free the buffer. |
1d4ec65
to
dde047a
Compare
@xiota Just out of curiosity, do you have a particular reason to force-push the last few commits instead of committing regularly with descriptions? We can squash-merge things in the end so the master commit log won't be polluted. |
@Thanatomanic Was just to keep the commit log clean. Didn't know you would squash merge. |
This was working yesterday, but it isn't working after I recompiled today without making any changes. |
It's working again. I was trying to make compiling with libjxl optional, but something was being cached, so it looked like it was working when it wasn't. Someone else will have to make the changes needed to make cmake detect and load libjxl as needed. (Right now it's required.) |
There was a time, where some png files led to crashes of RT when starting RT on a folder which such a file. |
Should I reenable PNG in this PR? Also, any advice/help for conditional compilation? |
Yes, but not in this PR imo (keep it cleanly focused on JXL).
@xiota Well, this is an issue indeed. I found out that on Windows MSYS2 does not provide the Lines 197 to 225 in 0e122a4
and set it to OFF by default. Then you should be able to conditionally check for the package, like here Lines 496 to 498 in 0e122a4
But I'm not at all familiar with the intricacies of CMake, so perhaps this doesn't work at all... |
Thanks for this effort! I would love to have JPEG XL import support in RawTherapee, what's needed to move this PR forward? |
Builds fine in Manjaro against libjxl-0.7.0 and libjxl_threads-0.7.0, and opens a sample .jxl file fine, though without any metadata. |
Is it to be expected that once we support evix2 this automagically works for jxl too? |
If exiv2 is built w/ BMFF support, then yes. |
Converting this to a draft because the GitHub Actions workflows still need to be updated to use the JXL library. Making JXL optional may also be necessary for the moment. |
Moving to 6.0 due to lack of activity. |
@xiota Would you be able to further work on this? If so, is there anything you need to move this forward? |
Issues I think holding this back:
|
No problem w/ this one: https://packages.msys2.org/base/mingw-w64-libjxl
You are not alone on that one 😉 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review of the diff with some minor change requests, most prominently the change from raw pointer buffer
to something more sane. 😉
@Floessie Thank you for reviewing. Let me know if I missed something or there's more. |
@xiota It's quite okay from my point of view now. Let @Lawrence37 comment on the Thanks for your contribution! 👍 |
* Remove cast in scanline * Improve Glib::ustring conversion
Checking in, since it's been nearly a month... anything else needed on my end for this? |
No, you are just waiting for functionality testing. It's unfortunate that no one has commented about their experience on the Pixls topic. I will test if no one else does, but I do have a backlog of other pull requests to review. |
@Lawrence37 Thanks for letting me know. No hurry... Just wanted to know the status. |
I got this error compiling with libjxl 0.8.2.
|
There was a change in API at some point, 0.9 I think... |
I test built only with 0.7 and 0.10 because those are the versions readily available in repos. Looks like the cutoff version I
I'll look for the commit that made the change |
You can also compare to the darktable #ifdefs, I think we got it right there: https://github.com/darktable-org/darktable/blob/master/src/imageio/imageio_jpegxl.c |
Maybe I misinterpreted how to choose the cutoff before. The changes were made in v0.9-snapshot-409-gb08a7049. darktable uses 0,9,0. Will change it. |
They make a note of API changes in their change log: https://github.com/libjxl/libjxl/blob/main/CHANGELOG.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functionality seem fine. It properly loads the embedded color profiles. EXIF data reads without issue (images without a container load without bugs). HDR images retain data. Animated and transparent images load (with necessary limitations).
2 things that could be improved but do not block this pull request:
- Transparent parts of images are not completely black. There is some weird smearing of colors from opaque areas. See the Dice image from https://jpegxl.info/test-page/.
- JXL status/library version could be added to AboutThisBuild.txt.
Switched from I suspect the color smearing may be how the file is actually encoded. To get rid of it, might have to decode and process the alpha channel. darktable shows the same effect. Does RT have any existing code that deals with transparency that I could look at?
I think this is done by code elsewhere. |
I don't know if the code is in RawTherapee itself, but transparency is handled for pngs and tiffs. |
Do you know what it shows in AboutThisBuild.txt if jxl support is disabled or if libjxl is not installed? One more possible improvement. Users who are upgrading will not see jxl images because their settings carry over. It would be good to automatically add the jxl extension to the list of file types to load if the version in the options file shows 5.10 or older. |
When not installed, it shows something like: When disabled, it shows the version that would have been installed. I'll change it to something nicer like
How is this handled when new raw formats are added? |
I don't think this was ever handled. The last addition was .ori, which is disabled by default anyway. The other extension in the git history is .cr3. Nothing special was done for that even though I think something should have been. |
Maybe enabling new file extensions could go in a separate PR that takes care of all of them together? Handling the transparency case could also go in a separate PR someday, like after jxl export is added. |
This allows RawTherapee to import JXL images. Addresses [the import portion] of #6273.