Add a Metadata panel with full generic TIFF/Exif/GPS tag support#11
Merged
Merged
Conversation
The Rust/WASM TIFF decoder now walks the raw IFD generically (via the tiff crate's tag_iter()/read_directory() APIs) instead of exposing a fixed set of curated fields, so every tag in the main IFD is surfaced, plus Exif and GPS sub-IFD tags reached by following their directory pointers recursively. The geotiff.js fallback path gets an equivalent (if less exhaustive) generic dump of whatever it already parsed. A new Metadata panel (Ctrl+M/Cmd+M, "Toggle Metadata Panel" command) shows this alongside basic file info and on-demand image statistics (min/max/mean/std, valid/non-finite pixel counts), with a "Copy as JSON" export. Wired for TIFF plus lighter file-info/stats support for EXR/NPY/PFM/PPM/HDR/PNG.
Previously only TIFF/GeoTIFF got a full generic tag dump; every other
format only showed dimensions/channels/stats. This closes that gap for
the formats that actually carry embedded metadata:
- RAW (libraw): the decoder already fetched a rich metadata object
(camera make/model, exposure, GPS, lens, vendor-specific blocks) and
discarded everything but width/height. Now flattened generically into
the same {name,value} tag rows the panel already renders.
- EXR: expose the exr crate's already-parsed header attributes (named
fields like owner/comments/captureDate/exposure/iso, plus its own
generic "other" custom-attribute bag).
- HDR (Radiance): collect header lines (comments, SOFTWARE=, VIEW=,
etc.) generically instead of only recognizing EXPOSURE/GAMMA/FORMAT.
- JPEG/PNG: locate the embedded Exif blob (JPEG APP1 "Exif\0\0" segment,
PNG eXIf chunk) and walk it with a new standalone bare-IFD reader —
the tiff crate's Decoder validates a full image directory and rejects
metadata-only blobs, so this reads the byte-level IFD structure
directly, reusing tiff::tags::Tag for readable names and recursing
into Exif/GPS sub-IFDs. PNG tEXt/zTXt/iTXt text chunks are also
surfaced (decompressed with pako where needed).
Verified end-to-end against real and synthetic files for every path
(OpenEXR-generated EXR with custom attributes, hand-built RLE HDR,
Pillow-generated JPEG with GPS Exif and PNG with eXIf/iTXt chunks).
Camera RAW vendor tag names beyond the ~200 core Exif tags (and Exif
tags outside the tiff crate's baseline registry) show as "Unknown(id)"
with the correct value rather than a friendly name — full data, not
maximally pretty. WebP/AVIF/JXL container Exif and TGA extension-area
metadata are not covered (no demonstrated need yet); NPY/PFM/PPM/PGM/PBM
have no embedded-metadata standard beyond what's already shown.
…itor context menu Truncating long arrays (e.g. StripByteCounts on a multi-strip TIFF) to "N more" contradicted the point of the tag dump: showing everything a file carries. Removed the cap in all three value-formatting paths (TIFF Decoder-based walk, the bare-IFD walker used for JPEG/PNG Exif, and the geotiff.js fallback's JS-side formatter) so every element of every array-valued tag is always shown. Also added "Toggle Metadata Panel" to the right-click menu on an open image preview (editor/context, alongside the compare commands) so it doesn't require the command palette or Ctrl+M/Cmd+M.
Wrong menu previously: the VS Code editor/context contribution isn't where the other toggles (histogram, color picker, copy image/position) live — those are all items in the extension's own custom-built right-click menu inside the webview. Removed the editor/context entry and added "Toggle Metadata Panel" there instead, directly below the color picker toggle.
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.
Add an metadata panel