Skip to content

Preserve namespace declarations used by retained XMP - #495

Open
gregbenz wants to merge 1 commit into
google:feat/preserve-xmp-metadatafrom
gregbenz:codex/preserve-stripped-xmp-namespaces
Open

gregbenz wants to merge 1 commit into
google:feat/preserve-xmp-metadatafrom
gregbenz:codex/preserve-stripped-xmp-namespaces

Conversation

@gregbenz

@gregbenz gregbenz commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

When a shared XMP description contains gain-map properties and other metadata, stripping can remove a namespace declaration that a retained child still uses. The resulting XMP has an unbound prefix and is no longer valid XML.

Keep namespace declarations on shared descriptions while removing the gain-map properties. Descriptions containing only gain-map metadata are still removed in full. This avoids having to scan retained subtrees to decide which declarations they need.

Adds a regression for a retained child using an inherited namespace and updates the shared-description test to check property removal instead of requiring namespace declarations to disappear.

Validation: the new regression fails before this change. All 14 focused tests pass with ISO and XMP output enabled, and all 9 pass with ISO-only output. Independent XML parsing also succeeds for the reproduced public-API case.

Also checked the regression XMP in a copy of a real Pixel JPEG through the public stripping API: the retained XMP parses correctly, the gain-map Version property is removed, and the primary compressed scan and decoded pixels are unchanged.

Keep namespace bindings on mixed descriptions when stripping gain-map properties so retained descendants do not acquire unbound prefixes. Continue removing descriptions containing only gain-map metadata.

Add a regression and retain existing property-removal coverage. Focused tests pass in dual-metadata and ISO-only builds; independent XML parsing validates the reproduced output.
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