TIFF previews will fail in WebView #58

Closed
opened 2026-08-25 09:16:17 +01:00 by gronod · 0 comments
Owner

Problem

WebViews / browsers do not natively decode TIFF format images. Setting raw TIFF base64 into img.src fails to render previews in the gallery.
Additionally, the image crate is currently placed in [target.'cfg(windows)'.dependencies] in Cargo.toml, making it unavailable on Linux and macOS builds.

Acceptance Criteria

  1. Cross-Platform image Dependency:
    • Move image = { version = "0.25", default-features = false, features = ["png", "tiff"] } from [target.'cfg(windows)'.dependencies] into standard [dependencies] in src-tauri/Cargo.toml.
  2. TIFF to PNG Conversion Command:
    • Add read_tiff_preview_png(path: String) command in src-tauri/src/commands.rs.
    • Decode TIFF, optionally constrain max edge to ~1200px, encode to PNG base64, and return to frontend.
  3. Frontend Integration:
    • Update src/js/printtarg.js to use read_tiff_preview_png for rendering target sheet previews.
    • Keep read_file_base64 strictly for text artefacts (such as .gam files).
### Problem WebViews / browsers do not natively decode TIFF format images. Setting raw TIFF base64 into `img.src` fails to render previews in the gallery. Additionally, the `image` crate is currently placed in `[target.'cfg(windows)'.dependencies]` in `Cargo.toml`, making it unavailable on Linux and macOS builds. ### Acceptance Criteria 1. **Cross-Platform `image` Dependency**: - Move `image = { version = "0.25", default-features = false, features = ["png", "tiff"] }` from `[target.'cfg(windows)'.dependencies]` into standard `[dependencies]` in `src-tauri/Cargo.toml`. 2. **TIFF to PNG Conversion Command**: - Add `read_tiff_preview_png(path: String)` command in `src-tauri/src/commands.rs`. - Decode TIFF, optionally constrain max edge to ~1200px, encode to PNG base64, and return to frontend. 3. **Frontend Integration**: - Update `src/js/printtarg.js` to use `read_tiff_preview_png` for rendering target sheet previews. - Keep `read_file_base64` strictly for text artefacts (such as `.gam` files).
gronod added the Kind/Bug label 2026-08-25 09:16:17 +01:00
gronod added this to the Milestone 7: v0.2 ship milestone 2026-08-25 09:42:06 +01:00
Sign in to join this conversation.