Skip to content

LR-EXP-WATERMARK: preview the watermark in the Export dialog (#827) - #843

Merged
bflatastic merged 2 commits into
storytold:mainfrom
john01px2022:john01px2022/watermark-preview
Oct 11, 2026
Merged

bflatastic merged 2 commits into
storytold:mainfrom
john01px2022:john01px2022/watermark-preview

Conversation

@john01px2022

@john01px2022 john01px2022 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of #827. Adds a watermark preview to the Export dialog, like the preview in Lightroom Classic's watermark editor.

What changed

  • With Watermark on, the Export dialog shows the first photo it will export, with the watermark drawn where the file will have it. The preview updates as soon as a setting changes.
  • The preview is as wide as the dialog for any photo shape (a portrait photo is tall). The cached 512 px thumbnail shows at once, then a render at the preview's own pixel size (in 128 px steps) replaces it on a worker thread, so it stays sharp. The web build, which has no worker thread, keeps the thumbnail only. The watermark is drawn on a copy only when the watermark, the output size or the picture changes, so moving a slider doesn't re-render the photo (about 1 ms per frame measured headless at 2×).
  • New export::draw_watermark_preview(img, wm, export_short_edge). Text is never drawn smaller than 6 px in an exported file. On a small preview, that minimum made small watermarks look bigger than they come out. The preview now scales the 6 px minimum (and the 1 px minimum shadow offset) by the preview size over the export size, which comes from output_size and so follows the Resize settings. Exports call the same code with a scale of 1, so exported files are unchanged.
  • The preview is shown through the display profile, like the Photo Merge preview.
  • Translations for "Loading preview…" and "Preview unavailable" in all nine catalogs.
  • LR-EXP-WATERMARK row in docs/parity-checklist.md updated.
pr843-full-width-portrait pr843-full-width-landscape

Tests

  • export::tests::watermark_preview_scales_the_minimum_text_size: a watermark held at 6 px in a 150 px export covers the same share of a 600 px preview. Drawn at the export's own size, the preview matches the export byte for byte.
  • headless::tests::export_dialog_previews_the_watermark: no preview without a watermark, and the preview appears when one is turned on.
  • export_dialog_keeps_its_width still passes (the preview doesn't widen the dialog).
  • I compared headless snapshots of the dialog against the exported JPEGs for a bottom-right and a centred watermark. Placement and size match.

CI

cargo xtask ci: fmt, clippy, heif, parity, layers, assets and wasm pass. In test, the only failure is lightcraft-mcp e2e export_progress_and_cancel. It fails the same way on main on this machine (Apple Silicon): the export finishes before the cancel arrives. That's #674, with a fix in #668. Every other workspace test passes.

Short windows

The preview makes the Export dialog taller (about 300 pt for a landscape photo and 700 pt for a portrait one at full width), so on a short window more of it runs off screen (#781, which happens even without this PR). #786 fixes that for every dialog. I merged #786 with this branch locally: in a 1400×760 window the dialog scrolls through the preview and watermark settings to the folder and preset rows, and Cancel / OK stay visible. This PR doesn't add its own scrolling, so the two don't conflict.

Merge order note

This PR and the #845 / #847 stack both edit the watermark tests and the LR-EXP-WATERMARK row. Whichever lands second has a small conflict (keep both sides). I'll rebase whichever is second.

🤖 Generated with Claude Code

…ld#827)

With Watermark on, the Export dialog shows the first photo it will export
(its cached thumbnail) with the watermark drawn as the file will have it.
The watermark is redrawn on a copy only when it or the output size changes.

draw_watermark_preview scales the 6 px minimum text size and the 1 px
minimum shadow offset by the preview size over the export size, so a small
watermark doesn't look bigger in the preview than in the file. Exports draw
with a scale of 1 and are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The preview was capped at 348 × 200 pt, so a portrait photo showed about
130 pt wide. It now spans the dialog for any photo shape. The cached 512 px
thumbnail still shows at once; a render at the preview's own pixel size
(in 128 px steps) then replaces it, so the wider preview stays sharp. The
web build, which has no worker thread, keeps the thumbnail only.

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

Copy link
Copy Markdown
Member

Landed in #981 together with #845 and #847 (on top of #833), so all of #827's watermark asks are in. Thanks again, @john01px2022!


Generated by Claude Code

@bflatastic bflatastic mentioned this pull request Oct 11, 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