Skip to content

Include filtered Exif, XMP metadata in jpeg-xl according to user's preferences instead of all-or-nothing workaround.#21344

Open
dholth wants to merge 4 commits into
darktable-org:masterfrom
dholth:jxl-write-filtered-exif
Open

Include filtered Exif, XMP metadata in jpeg-xl according to user's preferences instead of all-or-nothing workaround.#21344
dholth wants to merge 4 commits into
darktable-org:masterfrom
dholth:jxl-write-filtered-exif

Conversation

@dholth

@dholth dholth commented Jun 18, 2026

Copy link
Copy Markdown

Filter Exif data in memory, then write using the jpeg-xl encoder. This method is appropriate for jpeg-xl and might be appropriate for the other special-cased formats.

In jpeg-xl the Exif data does not affect rendering, but obviously we like to have it. Some people prefer to have Exif at the beginning of the file, which we do here.

Since the encoder is capable of adding metadata, I like this method better than what darktable does for most formats (re-opens the file later to add metadata). Having the encoder add all the metadata greatly reduces the concern that older versions of Exiv2, or Exiv2 compiled without brotli support, are unable to read it.

My version of Exiv2 is able to add the XMP metadata in an "xml " box at the end of the file. It would be nice to add the XMP metadata in the encoder as well, but this would require more refactors in imageio.c and a way to pass "should write xmp?" to jxl.c.

When exporting to jpeg-xl using this patch, e.g. $ jxlinfo -v P1180022.jxl shows that the file includes both Exif and xml (XMP) metadata.

box: type: "JXL " size: 12, contents size: 4
JPEG XL file format container (ISO/IEC 18181-2)
box: type: "ftyp" size: 20, contents size: 12
box: type: "jxlp" size: 30, contents size: 22
JPEG XL image, 3464x4610, lossy, 12-bit RGB
num_color_channels: 3
num_extra_channels: 0
intensity_target: 10000.000000 nits
min_nits: 0.000000
relative_to_max_display: 0
linear_below: 0.000000
have_preview: 0
have_animation: 0
Intrinsic dimensions: 3464x4610
Orientation: 1 (Normal)
Color space: RGB, D65, Rec.2100 primaries, PQ transfer function, rendering intent: Perceptual
box: type: "brob" size: 12690, contents size: 12682
Brotli-compressed Exif metadata: 12690 compressed bytes
box: type: "brob" size: 1898, contents size: 1890
Brotli-compressed xml  metadata: 1898 compressed bytes
box: type: "jxlp" size: 4034, contents size: 4026

This PR builds on, includes #21342

@dholth dholth changed the title Handle filtered Exif, XMP in jpeg-xl instead of all-or-nothing workaround. Include filtered Exif, XMP metadata in jpeg-xl according to user's preferences instead of all-or-nothing workaround. Jun 18, 2026
@dholth dholth force-pushed the jxl-write-filtered-exif branch from 60f9dd3 to 360c844 Compare June 19, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant