Repository navigation
fix(export): embed keywords, rating and label as XMP - #1896
Merged
Merged
Conversation
Exports dropped RapidRAW tags, so other apps saw no keywords (CyberTimon#1887). Write an XMP packet with dc:subject keywords (user: prefix stripped, colour tags excluded), xmp:Rating and xmp:Label into JPEG, PNG and WebP exports when "Save with Metadata" is on, reading tags from the image's own sidecar so virtual copies keep theirs. When the source is a non-RAW image with embedded XMP (e.g. DJI GPano panoramas, CyberTimon#1728), merge into that packet instead of discarding it, dropping properties the export makes stale (tiff:Orientation, pixel dimensions, crs: develop settings, extended-XMP pointer). Source XMP is skipped when "Remove GPS Data" is on since it can carry location. libwebp's lossy output is a simple-format file that little_exif cannot convert, so WebP exports silently lost all EXIF; convert it to the extended format first. Show the metadata options for PNG and WebP too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 of 17 tasks
Owner
|
Amazing!! Thanks so much for your hard work and testing 💯 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1887 (and the keyword half of the closed #1618), fixes #1728, and fixes the WebP part of #1322.
Tags set in RapidRAW never reached the exported file. With "Save with Metadata" on, exports now carry an XMP packet with the image's keywords, star rating and color label, so Lightroom, Bridge, digiKam, Immich and Windows Explorer pick them up.
This overlaps with #1626 by @chuckhenrich, which tackled the same bug first by injecting
dc:subjectkeywords. Credit to them for that. The differences here:user:/color:prefixes are stripped (in fix: inject XMP dc:subject keywords into exported images #1626, keywords come out asuser:landscape,color:red). Color tags becomexmp:Label, and the rating is written asxmp:Rating.Source XMP (#1728): for non-RAW sources such as DJI panoramas, the source's own XMP is kept, so
GPano:*and similar tags survive the export. RapidRAW's values are merged in: keywords are combined, and the rating and label replace the source's only when they are set. A few source properties that would be wrong after export are removed:tiff:Orientation, because the export resets orientation and this would rotate the photo twicecrs:develop settings, because Lightroom would apply the edits againWhen "Remove GPS Data" is on, the source XMP is skipped entirely, because drone XMP also carries location (
drone-dji:GpsLatitude, etc.).WebP had no EXIF at all: libwebp's lossy output is a simple-format (
VP8) file.little_exifcan't convert it to the extended format, sowrite_to_vecfailed and every WebP export lost its metadata, with only a log warning. The file is now converted toVP8Xbefore the EXIF and XMP are written.Type of Change
Changes Made
exif_processing.rs:write_image_with_metadataresolves the output format once, then runs the existing EXIF step (write_exif_metadata) followed by a new XMP step.ExportXmp::from_metadatacollects the keywords, rating and label from the sidecar.quick-xml, which is already a dependency.iTXt) or WebP (XMPchunk + VP8X flag).convert_webp_to_extendedadds the VP8X header for lossy WebP.file_management.rs:xmp_rating,xmp_labelandxmp_subject_bagwere pulled out ofsync_metadata_to_xmpso the sidecar sync and the export share them. The sidecar sync's output is unchanged.export_processing.rs: the sidecar is loaded once per image, and the XMP info is passed to the main and mask exports.ExportPanel.tsx: the Metadata section (Save with Metadata / Remove GPS Data) now also shows for PNG and WebP, which already used these settings without showing them.Cargo.toml:crc32fastfor the PNG chunk CRC. It's already in the lock file throughpng, so nothing new is compiled.Screenshots/Videos
Testing
Exports were checked for:
imagecrate and ImageMagick/libwebpA&B <x>)tiff:Orientation,crs:and its own keywords, which came out merged as described aboveTest Configuration:
Checklist
Additional Notes
write_image_with_metadataentry point as fix: write EXIF metadata and the sRGB profile into TIFF exports #1752 (TIFF metadata), so whichever lands second needs a small rebase. TIFF output is still skipped here, and fix: write EXIF metadata and the sRGB profile into TIFF exports #1752 covers it.AI Disclaimer:
Please state the involvement of AI in this PR:
🤖 Generated with Claude Code