Skip to content

Add a Metadata panel with full generic TIFF/Exif/GPS tag support#11

Merged
kleinicke merged 5 commits into
mainfrom
claude/compare-scientific-data-viewer-poaut2
Jul 2, 2026
Merged

Add a Metadata panel with full generic TIFF/Exif/GPS tag support#11
kleinicke merged 5 commits into
mainfrom
claude/compare-scientific-data-viewer-poaut2

Conversation

@kleinicke

Copy link
Copy Markdown
Owner

Add an metadata panel

claude and others added 5 commits July 1, 2026 14:04
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.
@kleinicke kleinicke merged commit 61b84e5 into main Jul 2, 2026
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.

2 participants