Skip to content

#745: import Targa (.tga) and Radiance HDR (.hdr) stills and sequences - #755

Open
vangel76 wants to merge 1 commit into
storytold:mainfrom
vangel76:gap-tga-hdr-import
Open

vangel76 wants to merge 1 commit into
storytold:mainfrom
vangel76:gap-tga-hdr-import

Conversation

@vangel76

Copy link
Copy Markdown

Fixes #745.

Part of ranked gap #17 "Media Browser lists files import refuses" (docs/gaps.md).

Problem

The Media Browser lists .tga and .hdr files (and image-sequence detection groups them), but media::is_importable had neither extension and the still decoder never tried them, so importing a Targa or Radiance HDR file failed.

Fix

  • crates/media/Cargo.toml: enable the image crate's built-in tga and hdr decoders. These features pull in no new crates, and Cargo.lock is unchanged.
  • crates/media/src/lib.rs: add tga and hdr to STILL_EXTENSIONS. A new still_format picks a still's format by its signature and falls back to the extension, because Targa has no signature. probe_bytes and MediaPool decoding both use it.
  • Radiance HDR decodes as 32-bit linear float and is sRGB-encoded like OpenEXR, so values above 1 are kept. Targa alpha comes in as straight alpha and goes through the existing unlabeled-alpha interpretation on import, as in After Effects.
  • crates/ui-egui/src/menus.rs: the File ▸ Import dialog filter now offers tga and hdr.
  • The gap Never crash: media crate without expect() #17 row and the Targa / Radiance rows in file-format-parity.md are updated.

Tests

New tests in crates/media/tests/footage.rs. Both fail without this change.

  • targa_still_matches_ffmpeg: ffmpeg encodes an RLE Targa with an alpha gradient. Our decode must be pixel-identical to the source PNG, the footage must be a still with straight alpha and codec TGA, and truncated files (hostile input) must be refused or decoded without panicking.
  • radiance_hdr_still_is_linear_float: a file written by the image encoder checks linear 0.214 → 0.5 and that super-white is kept. A second file from ffmpeg's Radiance encoder (RLE scanlines) must decode to sRGB-encoded mid grey within 0.01.

Gates

  • cargo fmt --all --check
  • cargo clippy -j 4 -p effectcraft-media -p effectcraft-ui-egui --all-targets -- -D warnings
  • cargo test -j 4 -p effectcraft-media (all targets)
  • cargo test -j 4 -p effectcraft-ui-egui (all targets)
  • cargo check -j 4 -p effectcraft-media --target wasm32-unknown-unknown
  • cargo xtask layers

I did not run the full cargo xtask ci locally because the machine is shared.

What remains

Note: the one-line change to the import-dialog list in menus.rs touches the same line as #735 and #742. Whichever merges second needs a trivial rebase.

🤖 Generated with Claude Code

… sequences

Problem: the Media Browser lists .tga and .hdr files (and groups them into
image sequences), but media::is_importable had neither extension and the
still decoder never tried them, so importing them failed.

Fix: enable the image crate's built-in tga and hdr decoders (no new
dependency), add both to STILL_EXTENSIONS and the File > Import dialog, and
pick a still's format by signature with an extension fallback, since Targa
has no signature. Radiance HDR is linear float light and is sRGB-encoded like
OpenEXR (super-white kept); Targa alpha goes through the existing
unlabeled-alpha interpretation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vangel76

Copy link
Copy Markdown
Author

Note: the File ▸ Import extension list in crates/ui-egui/src/menus.rs is also extended by #735 (STL) and #742 (FBX). Whichever of these lands later will get a one-line conflict there (keep all extensions); I'll merge current main into the remaining branches right after each merge.

This branch has not been deployed

No deployments
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.

Import Targa (.tga) and Radiance HDR (.hdr) stills and sequences like After Effects

1 participant