Feature: Stage 2 - Target Image Layout & printtarg Integration #4

Closed
opened 2026-08-21 10:29:29 +01:00 by gronod · 0 comments
Owner

Description

Implement the Stage 2 Printable Target Generation step. After .ti1 generation, the user configures instrument and page size, then the Rust backend spawns printtarg to produce printable TIFF images and a .ti2 layout file.

Toolchain Context

  • Backend: Rust (Tauri 2) — spawns printtarg via ProcessManager
  • Frontend: Vanilla JS webview with Tauri IPC
  • Binary resolution: commands::resolve_binary() resolves platform-specific sidecar from argyll/<platform>/printtarg

Implementation Plan

Backend (Rust)

  1. New Tauri command commands::run_printtarg(app, state, config):
    • Accept PrinttargConfig struct: { instrument: String, page_size: String, bit_depth: u8, dpi: u32, basename: String }
    • Build args: ["-v", "-i", <instr>, "-t"|"-T", <dpi>, "-p", <size>, <basename>]
    • Spawn via ProcessManager with appropriate working directory
  2. Output discovery: After exit, scan working directory for generated .tif files matching the basename pattern. Return file list as JSON via a new list_target_files(dir, basename) command.
  3. TIFF preview: Add a read_file_base64(path) utility command so the frontend can load generated TIFF images for in-app preview without filesystem access.

Frontend (JavaScript)

  1. Stage 2 panel (#stage-2):
    • Instrument dropdown: i1Pro/i1Pro2 → -i i1, ColorMunki → -i CM, SpyderPrint → -i SS
    • Page size dropdown: A4, US Letter, Custom (WxH mm)
    • Bit depth toggle: 8-bit (-t) / 16-bit (-T)
    • "Create Layout" button invokes run_printtarg
  2. TIFF preview gallery: After generation, display rendered target pages in a scrollable preview panel using base64-encoded images from read_file_base64. Show page count, dimensions.
  3. Critical UX warning: Prominent, non-dismissable banner:

    ⚠️ Print these target images with ALL printer driver colour management DISABLED.
    (e.g., "No Colour Adjustment" on Epson, "Off (No Colour Adjustment)" on Canon)

New/Modified Files

  • [MODIFY] src-tauri/src/commands.rs — add run_printtarg, list_target_files, read_file_base64
  • [MODIFY] src/index.html — expand Stage 2 panel with form controls and preview area
  • [NEW] src/js/printtarg.js — Stage 2 frontend logic
  • [MODIFY] src/styles/main.css — gallery and warning banner styles

Acceptance Criteria

  • User can select instrument, page size, and bit depth
  • Clicking "Create Layout" spawns printtarg and produces .ti2 + .tif files
  • Generated TIFF images displayed as in-app preview
  • Colour management warning banner is prominently displayed
  • Wizard auto-advances to Stage 3 on success

References

### Description Implement the Stage 2 Printable Target Generation step. After `.ti1` generation, the user configures instrument and page size, then the Rust backend spawns `printtarg` to produce printable TIFF images and a `.ti2` layout file. ### Toolchain Context - **Backend**: Rust (Tauri 2) — spawns `printtarg` via `ProcessManager` - **Frontend**: Vanilla JS webview with Tauri IPC - **Binary resolution**: `commands::resolve_binary()` resolves platform-specific sidecar from `argyll/<platform>/printtarg` ### Implementation Plan #### Backend (Rust) 1. **New Tauri command** `commands::run_printtarg(app, state, config)`: - Accept `PrinttargConfig` struct: `{ instrument: String, page_size: String, bit_depth: u8, dpi: u32, basename: String }` - Build args: `["-v", "-i", <instr>, "-t"|"-T", <dpi>, "-p", <size>, <basename>]` - Spawn via `ProcessManager` with appropriate working directory 2. **Output discovery**: After exit, scan working directory for generated `.tif` files matching the basename pattern. Return file list as JSON via a new `list_target_files(dir, basename)` command. 3. **TIFF preview**: Add a `read_file_base64(path)` utility command so the frontend can load generated TIFF images for in-app preview without filesystem access. #### Frontend (JavaScript) 1. **Stage 2 panel** (`#stage-2`): - Instrument dropdown: `i1Pro/i1Pro2 → -i i1`, `ColorMunki → -i CM`, `SpyderPrint → -i SS` - Page size dropdown: A4, US Letter, Custom (WxH mm) - Bit depth toggle: 8-bit (`-t`) / 16-bit (`-T`) - "Create Layout" button invokes `run_printtarg` 2. **TIFF preview gallery**: After generation, display rendered target pages in a scrollable preview panel using base64-encoded images from `read_file_base64`. Show page count, dimensions. 3. **Critical UX warning**: Prominent, non-dismissable banner: > ⚠️ Print these target images with ALL printer driver colour management DISABLED. > (e.g., "No Colour Adjustment" on Epson, "Off (No Colour Adjustment)" on Canon) #### New/Modified Files - `[MODIFY]` `src-tauri/src/commands.rs` — add `run_printtarg`, `list_target_files`, `read_file_base64` - `[MODIFY]` `src/index.html` — expand Stage 2 panel with form controls and preview area - `[NEW]` `src/js/printtarg.js` — Stage 2 frontend logic - `[MODIFY]` `src/styles/main.css` — gallery and warning banner styles ### Acceptance Criteria - [ ] User can select instrument, page size, and bit depth - [ ] Clicking "Create Layout" spawns printtarg and produces `.ti2` + `.tif` files - [ ] Generated TIFF images displayed as in-app preview - [ ] Colour management warning banner is prominently displayed - [ ] Wizard auto-advances to Stage 3 on success ### References - [README.md §5 — Stage 2: Target Image Generation](README.md#5-stage-2-target-image-generation-printtarg) - Upstream ArgyllCMS `printtarg`: [gronod/argyllcms](https://git.i3omb.com/gronod/argyllcms)
gronod added this to the Milestone 2: Target Generation Pipeline milestone 2026-08-21 10:29:29 +01:00
Sign in to join this conversation.