jxlpy icon indicating copy to clipboard operation
jxlpy copied to clipboard

Exif support

Open dbtsai opened this issue 4 years ago • 7 comments

Does it copy the exif and color space metadata to jpeg xl from the original input?

dbtsai avatar Jul 09 '21 22:07 dbtsai

Hi, Unfortunately for now that's not the case. You can see what's currently supported and what isn't in the table in the bottom of README. I couldn't find any way to add Exif metadata from high level libjxl api. I will be really grateful if someone smarter than me could figure out how to do it...

olokelo avatar Jul 09 '21 22:07 olokelo

Just figure that out. Maybe it's possible to add exif/color profile metadata using exiftool after the jpeg xl file is created.

dbtsai avatar Jul 09 '21 22:07 dbtsai

Oh really! It appears to be working fine. Mine ExifTool version is 12.26. This adds tag "rights" with value "AAA" into containerized JXL file.

$ exiftool -rights="AAA" a.jxl

It's also possible to copy all tags from one image to another. So probably that's a workaround for now but I really wanted to do that without external dependencies, it must be possible since cjxl does it but it's using entirely different api methods to do that.

olokelo avatar Jul 09 '21 22:07 olokelo

Awesome. Good to know it's working.

I don't see that cjxl will handle those colorspace or metadata as it's purely a compression/decompression codec. ImageMagick internally also uses exiftool to handle those metadata as far as I know. For lossless compression, it will be very nice that you can have a mode to do bit-wise comparison with the original input image before deleting them.

dbtsai avatar Jul 09 '21 22:07 dbtsai

I mean AFAIK cjxl supports copying Exif and XMP tags from original input into jxl container. It does that automatically if metadata is detected in source image. I'm not a JPEG XL developer so I have little idea on how things work internally but I've been experimenting with it for a while.

olokelo avatar Jul 09 '21 23:07 olokelo

Get it.

dbtsai avatar Jul 09 '21 23:07 dbtsai

Adding to this, you may need to use the -m flag so it adds the container if it's not present. For instance, I use this:

exiftool -m -artist="<PERSON>" -copyright="cc-by-nc-4.0 <ORGANIZATION>, 2022." -overwrite_original *.jxl

As for "copying from the original input", do you mean PIL Images in this case? https://stackoverflow.com/questions/17042602/preserve-exif-data-of-image-with-pil-when-resizecreate-thumbnail

alexjc avatar Nov 25 '22 12:11 alexjc