Files
+40 3a77137121 .kys import: tool keys and sets saved on Windows (K3) (#5345)
* Raw: measure the Nikon D90 image area (4288x2848 at (10, 10))

Aligning the decoded D90 sensor plane with the camera's own JPEG puts the
image at (10, 10) in the 4352x2868 sensor plane, giving the camera's
4288x2848 frame (10-pixel margins; the right border reads the camera's flat
255 from column 4310). Add the measured ImageArea so a D90 NEF opens on the
camera's frame instead of the uncropped plane, and make a measured profile
leave a file that carries its own colour calibration (a DNG) untouched.

* Codecs: open Cineon (.cin) film frames read-only

Cineon is the 10-bit logarithmic film-scan format DPX grew from. Read it from
the same Kodak header family: the generic header (big-endian, orientation at
192, channel count at 193, the channel-1 bits/dimensions), one or three
channels, three 10-bit samples packed into each 32-bit word on a word
boundary. The 10-bit code values open as U16 (round(c x 65535 / 1023)); the
file's log black/white points are a display choice and are not applied. A
depth other than 10 bits or a channel count other than 1/3 is Unsupported;
truncation errors rather than panicking. Read-only (no Cineon writer), so
.cin joins the open filters and Cineon read closes part of #1049's G10 gap.

* .kys import: tool keys and sets saved on Windows (K3)

Photoshop's <tool> rows now import: each matches our tool by name (our tool names are
Photoshop's) or by pc-id in sets PhotoCraft exported, and a letter other than the tool's own
becomes its override, while its own letter keeps the tool cycling with the others (#5036).

A set saved on Windows spells the primary modifier Ctrl where a Mac set writes Cmd and keeps
Control for the Control key. A set with no Cmd or Opt anywhere but some Ctrl is read as a
Windows set, its Ctrl as our Cmd: Ctrl+L is the Cmd+L default, not a Control-key override that
would also mean Control on a Mac. The import reports `windows`.

* Vector: bound flattening memory, keep over-budget dashes, cheaper edge build (#5195) (#5204)

* Vector: bound flattening memory, keep over-budget dashes, cheaper edge build (#5195)

- flatten: a path's flattened points are capped at 1 << 20; past it every
  curve keeps a proportional share of its pieces (at least one), so hostile
  handles from files (vmsk, SVG, effect outlines) cannot exhaust memory.
  fill_rasterizer flattens the whole path under one budget.
- stroke: past the dash step budget (or below coordinate precision),
  dash_polyline keeps the dashes made so far and draws the rest solid
  instead of dropping the stroke. Open polylines are no longer copied.
- raster: coordinates are clamped to +-1e15 and edges with a non-finite
  slope (vanishingly short) are skipped, so huge finite coordinates no
  longer produce NaN coverage. fill_rasterizer sorts edges once instead of
  after every component (stable sort, identical order).
- Cleanups: dead miter `half`, dead loop-length check in trace_mask,
  shared mask render body, map_knots helper, shared straight-segment test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Vector: bound stroke outline points (#5211)

- stroke_polygons dashes all lines first, then counts round caps and
  joins. When their full-resolution tessellation would exceed 1 << 20
  outline points, every round cap and join gets the same smaller segment
  count (down to 4 per circle, 1 per join; area-exact radius kept).
  Strokes under the budget are unchanged; no piece is dropped.
- The dash step budget (100000) is now shared by all lines of a stroke
  instead of per polyline, so many subpaths cannot multiply the dash
  (and cap) count. Past it the rest is drawn solid, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix: limit Render Video timeline and GIF staging allocations (#5670)

* fix(export): prompt for a Render Video output directory (#3365) (#3378)

fix(export): prompt for a Render Video output directory (#3365)

Also covers the same fix as #3390; thanks to its author.

Co-authored-by: buivanvu94 <[email protected]>

* fix(ui): avoid overflow when allocating layer style instance IDs (#4884)

* fix(ui): avoid overflow when allocating layer style instance IDs

* fix(ui): avoid panicking when layer style IDs overflow

* fix(ui): format non-panicking layer style ID allocation

* fix(doc): variable definitions follow layer id remapping on copy and load (#5023)

* fix(doc): variable definitions follow layer id remapping on copy and load

A duplicated document (image.duplicate, history.newDocument) or a .pcraft
loaded with remapped ids assigned fresh layer ids but cloned VariableDef.layer
unchanged, so datasets silently drove no layer (or, after remap, a colliding
one). Remap variable targets through the same id map as layer comps and
slices; a dangling target keeps a non-colliding placeholder. A merged-only
duplicate drops the whole variable binding set, matching how it drops comps.

Closes #4969

* style: cargo fmt duplicate_variables test

---------

Co-authored-by: highperfocused <[email protected]>

* fix(raw): reject truncated or oversized Deflate tiles in DNG import (#4977) (#5072)

* fix(history): count fill caches and smart filter masks in undo memory (#4972) (#5075)

* fix(ui): keep the close prompt up when a Save Document script edits the document after saving (#4953) (#5081)

* fix(geom): clamp huge sizes in Rect::from_xywh instead of wrapping, and saturate TileCoord::rect (#5161)

Co-authored-by: Saad Abdullah <[email protected]>

* fix(algo): keep clipped warp bounds from overflowing (#5451)

warp() computed the source-centre fallback as (x0 + x1) in i32 and the
inverse-mapped tile footprint as `floor() as i32 - 3` / `ceil() as i32 + 3`.
With a strongly skewed finite affine (for example Homography
[1, 1e12, 0, 0, 1, 0, 0, 0, 1] on a 32x32 clip) the float-to-int cast
saturates at i32::MIN/MAX and the following -3/+3 overflows, panicking in
debug builds and wrapping in release. A source rect with coordinates near
1.5e9 would overflow the centre sum the same way.

Widen the centre sum to f64 and use saturating_sub/saturating_add for the
footprint, which is intersected with src_rect afterwards anyway.

Add crates/algo/tests/warp_clipped.rs covering clipped-vs-full equivalence,
huge scale allocation, the extreme-affine footprint, and the far-origin
source centre.

Refs #3446

* fix(linux): install the AppImage menu entry when AppImageLauncher skips it (#5551)

AppImageLauncher exports DESKTOPINTEGRATION even after
X-AppImage-Integrate=false makes it skip the AppImage. AppRun treated that
variable as "already integrated" and wrote no .desktop file, so the menu
stayed empty. Skip our entry only when another .desktop file's Exec already
points at this AppImage.

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: nrq6993-a11y <[email protected]>

* FITS: clamp 32-bit saves to 0..1 and warn, so they reopen as saved (#5627) (#5628)

FITS: clamp 32-bit saves to 0..1 and warn, so they reopen as saved (#5627)

Also covers the same fix as #5642; thanks to its author.

Co-authored-by: nrq6993-a11y <[email protected]>

* Properties / New Document: tiny sizes in physical units no longer resize the document (#5661) (#5662)

The Width/Height fields in Properties > Document and in the New Document
dialog clamped their shown value to at least 0.01 of the unit. A 1 x 1 px
document at 300 ppi is 0.0033 in, so showing it in inches clamped it to
0.01 in, the field reported a change and the document became 3 x 3 px
(two history steps, no user edit). The fields now accept down to 0; the
pixel conversion afterwards already clamps to at least 1 px.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

* fix(psd): write the layer block after a kept merged-transparency marker (#5673)

A 16/32-bit document saved as PSD has its layers in a global Lr16/Lr32 block, which the writer put first among the global blocks. A Mtrn/Mt16/Mt32 marker kept from the opened file then followed it, and Photoshop refuses such a file (verified in Photoshop 2026 with psd-tools' transparentbg.psd re-saved both ways: Mt32 first opens, Lr32 first doesn't). The layer block now goes right after the last kept marker, as Photoshop orders them. Fixes #5068.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Options bar: Brush and Eraser size go to 5000 px in every theme (#5708) (#5709)

Options bar: Brush and Eraser size go to 5000 px in every theme (#5708)

Also covers the same fix as #5724; thanks to its author.

Co-authored-by: nrq6993-a11y <[email protected]>

* Smart Objects: Curves preview no longer zooms in on a reduced proxy (#5766) (#5779)

Adjustments and filters on a smart object add a smart filter, so their live
preview re-renders the smart object from its source through its placement.
The preview runs on a proxy document scaled down by k (large documents), and
proxy_document scaled the smart object's cache but left its transform (and
perspective and filter mask) in full-size document coordinates. The re-render
then came out k times too large on the proxy canvas, so the object looked
zoomed in until OK committed the full-size result.

proxy_document now scales the placement and the filter mask with the proxy.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fix Nikon NEF lossy levels, packed decoding and metadata crops (#3238)

Co-authored-by: optimalbytee <[email protected]>

* Curves: apply to masks, alpha, and Quick Mask (#5335) (#5448)

Curves: apply to masks, alpha, and Quick Mask (#5335)

Also covers the same fix as #5578; thanks to its author.

Co-authored-by: Zer0C00L01 <[email protected]>

* perf(ui): bound carried selection outlines and stabilize clipping (#5699)

Limit whole-selection transform traces to a padded one-million-cell grid
while preserving normal viewport caching and thin boundary samples.
Use double-precision intermediates for clipping long perspective lines.

Add regressions for large/disconnected selections and viewport accuracy
near the projective horizon. Preserve the full-resolution selection and
the transform behavior already landed in #5337.

Related: #5297, #3402.

Co-authored-by: LabDennis <[email protected]>

* fix(heif): a grid's ICC profile is inherited from its tiles (#5553)

fix(heif): a grid's ICC profile is inherited from its tiles

Also covers the same fix as #5591; thanks to its author.

Co-authored-by: nrq6993-a11y <[email protected]>

* fix(ui): expose toolbar column toggle in all themes (#3538)

fix(ui): expose toolbar column toggle in all themes

Also covers the same fix as #4680; thanks to its author.

Co-authored-by: Marco Arnulfo <[email protected]>

* Double-clicking the empty workspace shows File › Open (#5367) (#5429)

Double-clicking the empty workspace shows File › Open (#5367)

Also covers the same fix as #5461; thanks to its author.

Co-authored-by: Nigel Ihza Firdausy <[email protected]>

* fix(ui): a held arrow key keeps stepping the focused value field (#5474) (#5497)

Holding Up/Down in a value field (Character panel tracking, size, …)
stepped it a couple of times, then jumped focus to the field above.

Each arrow step re-requested focus on the field that already had it.
egui's request_focus resets the field's event filter, so on the next
frame egui no longer knew the field takes vertical arrows. A key repeat
landing on that frame was read as "move focus up". Single presses
rarely hit that frame; held keys always do.

Only request focus when the field lost it (after a typed sum gives it up
to be worked out). Regression test feeds key repeats on consecutive
frames with a field above and failed before the fix (focus moved after
two steps).

Fixes #5474

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(ui): ⇧ marquee square keeps equal sides on the pixel grid (#5472) (#5506)

The ⇧ square (and a 1:1 fixed ratio) is built in continuous document
coordinates, and `marquee_px` then snapped each axis to the pixel grid on
its own: floor the near edge, ceil the far one. A press between pixels,
dragged 100.5 px, snapped x to 101 and y to 102, so the readout and the
committed selection were off by one. `marquee_preview_px` now grows the
shorter side to the longer one, away from the press point, so the square
still covers every pixel the drag touched. Ants, readout and commit share
this path.

Fixes #5472

* fix(engine): validate bounded extended filter parameters (#5586)

* Guide Layout: the disabled Rows field no longer turns Rows on (#5625) (#5626)

The disabled Number field still drew a DragValue with range 1..=1000,
which clamps the default rows 0 to 1 and reports a change; writing that
back made the Rows checkbox's `positive` fallback turn on, so OK added
guides at the top and bottom. Disabled number fields no longer write
back. Kittest regression covers Rows and Columns.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

* Fix filter preview live during drag (#5549)

* Filter dialogs: paint the preview computed mid-drag instead of waiting for the pointer to stop

A preview that finished while the slider was still moving was thrown away before it
could reach the canvas, because the worker result had to match the request on every
field including the parameters. Every completion of a drag lands after the value has
moved on, so none of them matched, the worker was handed the newest value instead, and
that one went stale in turn. Nothing was ever painted while the pointer moved: the
effect appeared only once the slider had been still for about a frame of preview
time, which is what "I have to stop the slider and wait" looks like.

The display gate a few lines below already had the opposite rule. It compared the
document, revision, dialog, layer, channel target, command and proxy factor and
deliberately left the parameters out, so that a slightly old frame stays on screen
mid-drag. The publish gate disagreed with it and won, so the frame the display gate
was written to keep never existed.

Publish a successful result when the finished request matches the current one on
everything except the parameters, and let the existing display gate decide whether to
keep it. The two gates now share one predicate, FilterPreviewKey::same_target, so
they cannot drift apart again.

Errors keep the exact match. A value the pointer has already dragged past should not
raise a notice, and a failure is not something to show stale.

What this deliberately does not change:

- A reopened dialog has a new id, a committed document a new revision, a different
  command or channel target a different key, so a result from another preview is still
  never painted. Covered by a_reopened_dialog_discards_the_previous_dialogs_finished_preview.
- The freshly computed request is still what decides whether a new computation starts,
  so the worker still converges on the value the dialog actually holds.
- One preview runs at a time and a stale one is still cancelled only once the values
  settle, so this adds no work to the worker; it only stops discarding completed work.
- OK still recomputes at full resolution, so a frame shown mid-drag is never what gets
  written to the document.

Test: a_preview_computed_mid_drag_reaches_the_canvas starts a blur at one radius, moves
the slider before that preview lands, and requires the completed frame to reach the
canvas while the slider is still on the new value. It fails on the old gate, timing out
after 10 s with no frame published.

* Filter dialogs: three guards on a mid-drag preview, after review

The first version of this let any completed frame through that matched the dialog
on everything but the parameters. Review found three ways that is wrong, and all
three are now closed and pinned by a test.

A stale result with nothing to show. Storing it replaces a good frame with an empty
one, which the display gate paints as "draw nothing": the canvas blinks back to the
unfiltered layer mid-drag. The exact request may still store an empty result, which
is how a filter that no longer applies clears the canvas, so the guard belongs on
the stale arm only. Splitting the match arm is what makes that separable; the
earlier single arm forced a false choice between the two.

A late frame replacing an exact one. Drag the slider away and straight back: the
frame on screen is already exact for the dialog, and the in-flight frame for the
value on the way out would have overwritten it, showing a blur the user has already
undone. A stale result is now dropped when the stored preview is already exact.

Errors were already scoped to the exact request and stay there: a value the pointer
has dragged past should not raise a notice, and the value it comes to rest on will
raise its own when it is recomputed.

Also pinned by test, because both are easy to undo by accident:

- The reopen test was not reaching the gate. discard_closed reclaims a closed
  dialog's job a frame earlier in the real app, and the test called it too, so the
  stale result never arrived and the test passed even with the dialog id removed
  from the comparison. It now drives the gate directly. Verified by mutation.
- The mid-drag test asserted nothing about what the display gate does with the
  published frame, so re-adding params there passed. It now asserts the canvas
  actually returns something to draw, and it keeps polling until a frame for the
  dialog's current value lands, which is what pins fresh to an exact match.

Tests are deterministic: the worker job is gated on a channel and signals when its
result is already in the worker channel, so nothing sleeps and nothing races the
150 ms settle timer that cancels a job whose values stopped changing.

Verified by mutating each guard and confirming a test catches it:
  publish gate back to exact-match ................. killed
  drop the is_some guard ........................... killed
  drop the already-exact guard .................... killed
  same_target ignores the dialog id ............... killed
  display gate compares params again .............. killed
  fresh relaxed to same_target .................... killed
  same_target ignores k ........................... killed

k stays in the comparison on purpose. A 36 MP document previews at k=4, and
preview_factor lowers k as a pixel-sized parameter approaches its minimum, so k does
change under the slider. Relaxing it would paint a frame at a scale the preview
policy exists to avoid, and would loosen the display gate further than upstream
wrote it. The cost is a one-computation pause when the slider crosses a threshold
on a large document; that test keeps the choice visible.

* Filter dialogs: fix a race in the new tests that let CI pass them

The four new tests signalled each other through a channel the worker sends from inside
`compute`. But the worker only puts the result into the channel after `compute` returns:

    let result = compute(&work);
    let _ = tx.send(result);

So a test that woke on the signal and called `ensure_filter_preview` immediately could
reach `poll()` before that send. On a loaded CI runner it did: ubuntu failed
`a_mid_drag_empty_result_leaves_the_preview_alone` with no frame published at all. The
comment in the test claimed the result was already in the channel, which was the one
thing it was not.

The tests now drive the canvas until the state they need appears, which does not depend
on the order of that send. They also check their invariant on every pass rather than
only at the end: a wrongly published frame can be replaced by the next, correct one
before the loop stops, which had already left the reopen, late-frame and empty-result
tests unable to see their own mutation.

Unchanged: the assertions, the production code, and the four mutations that broke each
guard — re-verified, 7 of 7 still caught.

Runs: 30 back-to-back runs of the four tests on 12 cores, no failure; the full crate
twice, 2800 pass.

---------

Co-authored-by: agent-346022 <[email protected]>

* Fix #5414: Keep created paths visible and editable (#5424)

* Paths: keep work and shape paths visible with any tool (#5414)

* Tests: improve path overlay regression coverage

* fix(ui): widen tool-options drag targets (#5135)

Co-authored-by: haranishi <[email protected]>

* fix(cms): write the product name as PhotoCraft in built-in profile descriptions (#5614)

* style: rustfmt five files on main (fmt break from #5448, #5670, #5135) (#5873)

Formatting only; cargo fmt --all -- --check passes again.

* cargo fmt the extension lists

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Document layerFilter in the ui_set MCP schema (#5776)

Co-authored-by: FredApps <[email protected]>

* i18n(hu): align six rows with the catalog conventions (#5434)

Three prompts used the formal verb form ("Adjon", "Válasszon",
"kattintson"); the catalog addresses the user informally throughout.

Two colour profile messages put an article before a placeholder
("A(z) „{name}”") and glued a suffix to one ("{mode}-profilja"). The
correct form depends on the inserted value, so the placeholders now
stand after a colon or in brackets.

The Ask On Mismatch hint kept the English option name; it now names
the Hungarian label of that option in Color Settings.

* UI: centre text vertically in shared text fields (#5550)

* UI: centre text vertically in shared text fields

TextEdit draws its line at the top of its rect, and the theme's 24 pt
interact height made the edit taller than the field's inside, so text in
widgets::text_field sat a few pixels high (Preferences search, hex fields,
name fields) while dropdowns and value fields were centred. Fill the box
and centre the line in it.

* Fixed failing test

---------

Co-authored-by: Stevan Marjanović <[email protected]>

* fix(ui): the Move tool keeps Photoshop's arrow pointer (#5814)

The canvas cursor match mapped Tool::Move to CursorIcon::Move, the 4-way
move cursor, while Photoshop shows its standard arrow pointer and marks the
movable layer with the hover outline. Use CursorIcon::Default for the tool
(#5646).

* fix(pen): keep unfinished paths in their original document (#5460)

* fix(pen): finish draft before creating a document

* test(pen): keep open work path in its source document

* Drag and drop: PhotoCraft comes to the front after a drop (#5687) (#5894)

Files dropped from another app's window (a file manager) were imported, but
the source window stayed in front of PhotoCraft. The frame that takes a drop
now asks for focus, so PhotoCraft comes forward as Photoshop does.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Options bar: Show Transform Controls in every theme (#5740) (#5802)

The Studio, Adwaita and Breeze themes' Move tool options bar had only Auto-Select and a hint, so Show Transform Controls could not be turned on there and a click on a layer never showed its box and handles. The toggle is now in every theme, as Auto-Select is (#1275).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Preserve Layers scroll per document (#5522) (#5540)

* chore: reserve draft implementation for #5522

* fix(ui): retain each document's Layers scroll position (#5522)

* Rulers: Alt-drag makes a guide of the other orientation (#5698) (#5885)

As in Photoshop, dragging a guide out of the top ruler with Alt/Option held
makes a vertical guide, and out of the left ruler a horizontal one; without
Alt each ruler makes its own kind, as before.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Adjustment layers: a live preview is never coarser than the screen (#5764) (#5778)

Dragging a Curves point (or any control) in the Properties panel of an
adjustment layer previews through `canvas::ensure_proxy_preview`, which
picked its downscale factor from the document size alone
(`proxy::preview_factor`): any document over 5 MP was drawn from a 2-5x
reduced copy at every zoom, so at 100 % the canvas turned blocky until
the mouse was released.

Cap the factor by the view's zoom with the rule the Image > Adjustments
dialogs already use (`adjust_preview::proxy_factor`: the proxy stays at
least at screen resolution) when the wgpu compositor can draw the
full-size document. At 50 % and closer the drag now shows the full-size
composite; zoomed out, the proxy still saves the work. Documents the GPU
compositor doesn't cover keep the old proxy (the full size would be a
CPU composite per change).

Co-authored-by: Claude Opus 5.5 <[email protected]>

* UI: unsaved-changes buttons show every key in one style (storytold/photocraft#5564) (#5603)

German showed "Ja (Y)" next to "(N)ein". Keys now go inside the words only when
every translated label starts with its key; otherwise all labels append it
("Ja (Y)", "Nein (N)", "Abbrechen (C)").

Co-authored-by: Cursor <[email protected]>

* macOS: a bundled app keeps its own Dock icon (#5849) (#5879)

The main window set a runtime PNG icon everywhere. On macOS that replaces the
app bundle's PhotoCraft.icns in the Dock, so the system couldn't render it
in its own style (Liquid Glass and its tinted and dark variants). The runtime
icon is now skipped when running from an .app bundle; unbundled runs and the
Windows and Linux builds still set it.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Title bar: dialogs no longer stop the window dragging on macOS (#5826) (#5860)

The overlay that keeps the title strip's free gap draggable under a dialog's
modal layer (#4913) only ran with the custom title bar. macOS keeps the OS
traffic lights over the app's own title strip (custom_titlebar is false), so
with the Embedded Profile Mismatch prompt or any dialog open the window could
not be moved. The overlay now runs whenever the strip is drawn.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(path): Shift locks a Direct Selection anchor drag to 45° (#5475) (#5498)

Dragging selected anchors with the Direct Selection tool ignored Shift,
so lengthening a slanted bar also nudged it vertically. As in Photoshop,
Shift now locks the anchor move to multiples of 45° from the press, in
the live preview and in the committed path.moveAnchors. It works whether
Shift is held from the press or added during the drag; Shift at the
press still toggles the anchor's selection as before.

Reuses stroke_constraint::snap45 (the Gradient tool's Shift lock).

Fixes #5475

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>

* Type: keep text selection highlight visible while Command/Ctrl is held (#5542)

* Type: keep text selection highlight visible while Command/Ctrl is held

* Type: match Photoshop 1px dark frame and handle styling for type transform

* Merge main; keep the transform box and underline colours from the theme tokens

The selection-highlight fix stands on its own; the hard-coded box and
underline colours and the removed reference point were unrelated to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: safvanedge <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* Filter dialogs: a Random button for seeds (#5710) (#5886)

Clouds, Difference Clouds, Add Noise, Fibers and the other seeded filters
exposed a seed number, but a new pattern meant typing a different one. A
Random button beside every seed field now picks a fresh seed, which the live
preview renders at once. "Random" gains its row in the zh-Hans, zh-Hant, ru,
fr and id catalogs, which claim complete coverage.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Brushes: dragging a preset to the list's edge scrolls the list (#5741) (#5862)

A preset, group or folder dragged in the Brushes panel or the Brush Preset
picker couldn't reach rows out of view: the list didn't scroll while
dragging, so the drag stopped at the last visible row. Holding the drag at
the list's top or bottom edge (or past it) now scrolls it, with the same
ramp as the Layers panel's row drags.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(ui): smart filter adjustments open their own editor on double-click (#5812)

An Image > Adjustments recorded on a smart object (Brightness/Contrast,
Levels, Curves...) stores image.adjustments.<kind>. The Layers panel row
called smart_ui::open_editor, which only knew filter_dialog and silently did
nothing for those commands, so the filter could never be reopened. Route
adjustments to adjust_dialog, seed it with the recorded params and let OK run
layer.smartFilter.setParams (#5689).

* Canvas: no scroll glide with Enable Animations off (#5721) (#5883)

Interface > Enable Animations off already made scroll areas jump straight
to their target, but the canvas still panned from egui's smoothed wheel
delta, gliding for several frames after each notch. With the preference off
a plain wheel scroll now moves the canvas by the whole notch in the frame it
arrives and stops there.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Scaling around reference point no longer snaps center of image to reference point (#5510)

Co-authored-by: Stevan Marjanović <[email protected]>

* Type: a scaled type layer keeps its size when the Character fields show it (#5717) (#5718)

egui's DragValue clamps an existing value to its range and reports a change, so showing a
type layer scaled past 1296 pt (or below 0.1 pt) sent type.setStyle with the clamped size.
Value fields now clamp only edits, never a value they merely show.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

* fix(ui): restore previous tool when committing or canceling text edit (#5527) (#5528)

* fix(ui): restore previous tool when committing or canceling text edit initiated via double-click

* fix(ui): restore return tool only while on type and stay on type for layer thumbs

- commit_with/cancel: restore return tool only while app.ui.tool.is_type()
- edit_active: keep tool on Type when editing from layer thumbnail (matches Photoshop)
- clear text_edit_return_tool when text_edit is dropped on lost text or stale transform
- test tool switch mid-edit and edit_active remaining on Type

---------

Co-authored-by: safvanedge <[email protected]>

* File › Scripts › Browse: reject Photoshop ExtendScript (#5406) (#5435)

* File › Scripts › Browse rejects Photoshop ExtendScript.

The picker listed .js/.jsx files that parse_script cannot run. Filter to
JSON/text/droplet scripts and return a clear error for .js/.jsx paths.

* File › Scripts › Browse keeps Photoshop extensions in the picker.

Review feedback on #5435: filtering .js/.jsx out of the picker hid the
rejection error from UI users. List Photoshop's script types (as #2452
asked) alongside PhotoCraft's so selecting one shows the ExtendScript
error instead of hiding the file.

* Channels: load the targeted layer mask as selection (#5562)

* Load the targeted layer mask from Channels footer

* Fix Channels test setup after mask reveal

* Type: Swap and Default Colors recolour the selected text (#5690) (#5808)

The toolbar's Switch Colors and Default Colors buttons ran their commands
without type_tool::foreground_changed, so characters highlighted in the
type layer being edited kept their colour. As in Photoshop, they now take
the new foreground, like picking a colour in the Color or Swatches panel.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

* Image Size, Canvas Size: points and picas follow the Point/Pica Size preference (#5756) (#5757)

The dialogs converted points and picas at a fixed 72 pt/in, while the
rulers, Info, layer properties and the shape dialog use Preferences >
Units & Rulers > Point/Pica Size. With Traditional (72.27) a document
showed different point sizes in the rulers and in Image Size.

The dialog now stores the preference's points per inch when it opens
(__ptPerIn, 72 when missing) and uses it for points, picas (points / 12)
and typed units in the Width/Height fields.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

* Pen and Path Selection: Delete deletes the finished work path (#5702) (#5732)

A finished work path is drawn whenever the Pen, Freeform Pen or Path
Selection tool is active, and it is saved with the document, as in
Photoshop. But once the path was finished, Delete/Backspace fell through
to Edit > Clear (the pixels under it), so the only ways to remove it were
the right-click Delete Path and the Paths panel, and it looked impossible
to delete.

With those tools, no path being drawn and the work path the one they
edit (no shape layer or targeted vector mask in front of it), an
unmodified Delete/Backspace now runs path.delete on the work path: one
undoable Delete Path step. Direct Selection and the Curvature Pen are
left alone, since Photoshop deletes their selected anchors, not the path.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Layer Style: drag on the image to move a drop or inner shadow (#5701) (#5893)

As in Photoshop, with the Layer Style dialog on a Drop Shadow or Inner Shadow
page, dragging on the image moves the shadow: its offset follows the pointer
and is stored as the effect's angle and distance (whole degrees and pixels),
moving the shared global light angle when the effect uses it. Space and the
middle button still pan; colour pickers still sample.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Free Transform: shapes and paths stay on whole pixels (#5751) (#5841)

* Free Transform: shapes and paths stay on whole pixels (#5751)

With Snap Vector Tools and Transforms to Pixel Grid on, only the pointer was
rounded, and only while a shape tool was active. Under the Move tool, or with
a grab offset or a proportional scale, the box landed between pixels (a
rectangle dragged to 540 px came out 539.6). An upright box on a shape layer
or path now keeps whole-pixel edges whatever the tool.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Format (cargo fmt)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Snapping: snap a drawn marquee, Object Selection box or shape by its edges while Space repositions it (#5748)

* Move: Show Transform Controls frames every selected layer (#5917)

As in Photoshop, with several layers selected (Shift-click with Auto-Select,
or the Move marquee) Show Transform Controls draws one frame around all of
them (the Background excluded) and outlines every selected shape layer.
Before, the frame showed only the active layer, so the other selected layers
had no feedback on the canvas. The frame joins the boxes Free Transform would
open on each layer (transform_frame), and it hides while a corner radius
widget is dragged.

Free Transform works on one layer, so the shared frame has no handles and a
press on it doesn't start Free Transform; a drag inside still moves every
selected layer.

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Warp: a thin layer stretched and bent keeps its curve on commit (#5793) (#5810)

* Warp: a thin layer stretched and bent keeps its curve on commit (#5793)

The mesh warp sized its triangle grid by the source rectangle only (one cell per 4 source px). A 3 px column scaled into a wide band and then warped got a single cell across, so the committed result was a straight, affine band while the preview showed the curve. The grid now also follows the destination length of the mapped rows and columns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Warp: module doc describes the grid sized on both sides of the map (#5793)

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Dialogs: a close box in the title bar cancels like Cancel (#5496) (#5505)

Dialogs drawn by the shared renderer had no close box: the only ways
out were Cancel/OK or Esc. As in Photoshop on Windows, the title band now
ends in a × (the icon button the floating panels close with) on Windows,
Linux and the web, none on macOS. A click on it joins Esc in the single
cancel path of `dialogs::show` (outcome = Cancel -> `cancel()`), so the
live preview goes and nothing reaches the document or history. The × is
left out of the title band's drag area, so a drag starting on it neither
moves nor closes the dialog; the rest of the band still drags.

Check Spelling (an untitled window) gets the same close box; it is Done,
as every change there is already made.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

* fix: commit type editing on Layers-panel selection (#5584) (#5612)

* Info panel: show guide coordinates while dragging outside the canvas (#5728) (#5768)

* Fix Info panel guide coordinates during ruler drags (storytold/photocraft#5728).

Show the dragged guide position on one axis while the pointer is outside the canvas, matching Photoshop.

Co-authored-by: Cursor <[email protected]>

* Merge main; fill GuideDrag's new press field in the test; cargo fmt

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(ui): brush outline matches the stroke on Wayland at fractional scales (#5796)

* fix(ui): brush outline matches the stroke on Wayland at fractional scales

On Hyprland at 1.25 the brush outline was 1.25x too large and sat right of
and below where the brush painted, by more the larger the brush. The engine
places dabs exactly; the OS cursor bitmap was wrong. winit 0.30 sizes custom
cursor bitmaps on Wayland with a wp_viewport destination whenever the scale
isn't 1, and Hyprland (like Mutter before GNOME 48) ignores viewports on
cursor surfaces: it shows the bitmap one pixel per logical pixel with the
hotspot winit divided by the scale.

A client can't tell which compositors do this, so on Wayland at any scale
but 1 the brush outline and crosshairs are painted in-app, as on the web.
Other platforms and Wayland at scale 1 keep the low-latency OS bitmap.

Measured on Hyprland 0.56.2 at 1.25 (100 % zoom, 100 px brush): dab centre
(288.5, 560.5), diameter 97 px; outline before (303, 574.5), ~130 px;
after (288.5, 562), 107 px including its border.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Merge main; cargo fmt

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>

* Raw: measure the Nikon D90 image area (4288x2848 at (10, 10)) (#4323)

Aligning the decoded D90 sensor plane with the camera's own JPEG puts the
image at (10, 10) in the 4352x2868 sensor plane, giving the camera's
4288x2848 frame (10-pixel margins; the right border reads the camera's flat
255 from column 4310). Add the measured ImageArea so a D90 NEF opens on the
camera's frame instead of the uncropped plane, and make a measured profile
leave a file that carries its own colour calibration (a DNG) untouched.

Co-authored-by: Brandon Thomas <[email protected]>

* Codecs: open Cineon (.cin) film frames read-only (#4691)

* Raw: measure the Nikon D90 image area (4288x2848 at (10, 10))

Aligning the decoded D90 sensor plane with the camera's own JPEG puts the
image at (10, 10) in the 4352x2868 sensor plane, giving the camera's
4288x2848 frame (10-pixel margins; the right border reads the camera's flat
255 from column 4310). Add the measured ImageArea so a D90 NEF opens on the
camera's frame instead of the uncropped plane, and make a measured profile
leave a file that carries its own colour calibration (a DNG) untouched.

* Codecs: open Cineon (.cin) film frames read-only

Cineon is the 10-bit logarithmic film-scan format DPX grew from. Read it from
the same Kodak header family: the generic header (big-endian, orientation at
192, channel count at 193, the channel-1 bits/dimensions), one or three
channels, three 10-bit samples packed into each 32-bit word on a word
boundary. The 10-bit code values open as U16 (round(c x 65535 / 1023)); the
file's log black/white points are a display choice and are not applied. A
depth other than 10 bits or a channel count other than 1/3 is Unsupported;
truncation errors rather than panicking. Read-only (no Cineon writer), so
.cin joins the open filters and Cineon read closes part of #1049's G10 gap.

* cargo fmt the extension lists

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Brandon Thomas <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Vikram Bhaskaran <[email protected]>
Co-authored-by: Brandon Thomas <[email protected]>
Co-authored-by: Valentin Klein <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Nigel Ihza Firdausy <[email protected]>
Co-authored-by: buivanvu94 <[email protected]>
Co-authored-by: mroxso <[email protected]>
Co-authored-by: highperfocused <[email protected]>
Co-authored-by: MarekSpodBiedry <[email protected]>
Co-authored-by: Saad Abdullah <[email protected]>
Co-authored-by: Saad Abdullah <[email protected]>
Co-authored-by: Skyfuller <[email protected]>
Co-authored-by: nrq6993-a11y <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: nrq6993-a11y <[email protected]>
Co-authored-by: David Mann <[email protected]>
Co-authored-by: nrq6993-a11y <[email protected]>
Co-authored-by: FinnNk <[email protected]>
Co-authored-by: Michael Higgins <[email protected]>
Co-authored-by: optimalbytee <[email protected]>
Co-authored-by: optimalbytee <[email protected]>
Co-authored-by: Zer0C00L01 <[email protected]>
Co-authored-by: Sir Clangington III. <[email protected]>
Co-authored-by: LabDennis <[email protected]>
Co-authored-by: Sidney Markowitz <[email protected]>
Co-authored-by: Marco Arnulfo <[email protected]>
Co-authored-by: Daktyl <[email protected]>
Co-authored-by: Juan Antonio Redondo <[email protected]>
Co-authored-by: Sabbir Ahmed <[email protected]>
Co-authored-by: Jason Xiang <[email protected]>
Co-authored-by: agent-346022 <[email protected]>
Co-authored-by: agent-346022 <[email protected]>
Co-authored-by: Ahmed0_0Mamdouh <[email protected]>
Co-authored-by: Ikki Nishihara <[email protected]>
Co-authored-by: haranishi <[email protected]>
Co-authored-by: wwew <[email protected]>
Co-authored-by: FredApps <[email protected]>
Co-authored-by: FredApps <[email protected]>
Co-authored-by: Bihacsy László <[email protected]>
Co-authored-by: Stevan Marjanović <[email protected]>
Co-authored-by: Stevan Marjanović <[email protected]>
Co-authored-by: midasmatterhorn <[email protected]>
Co-authored-by: safvanedge <[email protected]>
Co-authored-by: safvanedge <[email protected]>
Co-authored-by: Stevan Marjanović <[email protected]>
Co-authored-by: envy-ai <[email protected]>
Co-authored-by: WendelVolm <[email protected]>
Co-authored-by: baz <[email protected]>
Co-authored-by: Khawar Zamman Wani <[email protected]>
2026-10-15 00:28:46 -04:00
..

photocraft-codecs

Codecs for flat raster image formats, written in pure Rust. The crate is standalone: it depends on no other workspace crate and defines its own Image type. It also builds for wasm32-unknown-unknown and does no I/O: decoders take &[u8] and encoders return Vec<u8>.

It follows the "Avoiding GIMP's hole" rules in docs/architecture.md §1.1:

  • Symmetric. Every format we write, we can also read. The only exceptions are listed in ASYMMETRIC_EXCEPTIONS, each with a reason. The test suite checks this.
  • Depth-preserving. An image can hold U8, U16, F16 or F32 samples, and each format keeps what it can hold.
  • Metadata-preserving. ICC, EXIF, XMP, DPI and text are kept wherever the format supports them.
  • Honest. caps(format) says what each format holds, and fidelity_warnings(&image, format) lists what an export will lose before you write it. Both functions use the same encode plan as encode, so a warning appears exactly when the file changes. On the way in, Image::warnings lists what the decoded image doesn't show: frames or pages left out, or data that ended early.
use photocraft_codecs::*;

let img = decode(&bytes)?;                               // detect + decode (default Limits)
for w in fidelity_warnings(&img, Format::Jpeg) {         // e.g. "16-bit will be reduced to 8-bit"
    println!("{w}");
}
let out = encode(&img, Format::Tiff, &EncodeOptions::default())?;

Capability matrix (default build)

Format Read Write Depths (native) Layouts (native) Alpha ICC EXIF XMP DPI Text Lossy write Backend
PNG yes yes U8, U16 Gray, GrayA, RGB, RGBA yes yes (iCCP) yes (eXIf) yes (iTXt XML:com.adobe.xmp) yes (pHYs) yes (tEXt/zTXt/iTXt) no png
JPEG yes yes U8 Gray, RGB, CMYK no yes (multi-segment APP2) yes (APP1) yes (APP1) yes (JFIF) no yes zune-jpeg / jpeg-encoder
TIFF yes yes U8, U16, F32 all six (CMYK, CMYK+A included) yes yes (tag 34675) no yes (tag 700) yes yes (Description, Make, Model, Software, DateTime, Artist, Copyright) no tiff
WebP yes yes U8 RGB, RGBA yes yes yes yes no no yes (VP8, when webp_lossless is off) image-webp / built-in VP8
GIF yes yes U8 RGBA 1-bit no no no no no yes (256-colour palette) image
BMP yes yes U8 RGB, RGBA yes no no no no no no image
TGA yes yes U8 Gray, GrayA, RGB, RGBA yes no no no no no no image
ICO yes yes U8 RGBA (at most 256×256) yes no no no no no no image
DDS yes no U8 Gray, GrayA, RGB, RGBA yes no no no no no n/a built in
Netpbm (PBM/PGM/PPM/PAM/PFM) yes yes U8, U16, F32 (float: PFM gray/RGB only) all six (PAM CMYK/CMYK_ALPHA) yes (PAM) no no no no no no built in
QOI yes yes U8 RGB, RGBA yes no no no no no no image
OpenEXR yes yes F16, F32 Y, YA, RGB, RGBA yes no no no no no no exr
Radiance HDR yes yes F32 RGB no no no no no no yes (RGBE) image
FITS yes yes U8, U16, F32 Gray, RGB no no no no no yes (header cards) no built in
DPX yes yes U8, U16 (10/12-bit code values read and written exactly through U16) Gray, RGB, RGBA yes no no no no DPX header fields only (creator, project, copyright, creation time, transfer, colorimetric, frame position, frame rate, time code) no built in
Cineon yes no U16 (10-bit code values) Gray, RGB no no no no no no n/a built in
AVIF no only with feature avif U8 RGB, RGBA yes no no no no no yes image + ravif
HEIF/HEIC with feature heif no U8, U16 (10/12-bit decodes to U16) RGB, RGBA yes (auxiliary alpha) yes (colr prof) yes yes no no n/a heic-rs

"Native" means the data is stored and read back without conversion. Anything else is converted by the encode plan, and fidelity_warnings reports the conversion when it loses information:

  • A float image written to an integer format goes to U16 where the format supports it. Values outside 0..1 raise RangeClipped.
  • Integer data written to a float-only format (EXR, HDR) becomes F32 without loss.
  • CMYK is converted to RGB with a naive formula that is not colour-managed. CmykConverted is raised and the ICC profile is dropped, because a CMYK profile does not describe RGB data.
  • Gray written to an RGB-only format is expanded to RGB without loss, so no warning is raised.

Image::convert applies the same ICC rule: it keeps the profile only when the colour model stays the same.

Palette BMP and PNG pixels decode as RGB(A) in Image; bmp_palette and png_palette expose the embedded table (and a PNG's transparent entry) so photocraft-io can open them in Indexed Color mode.

Documented asymmetries and limitations

  • DDS. The top mip level of a 2D texture: uncompressed pixels described by channel masks (8, 16, 24 or 32 bits, RGB or luminance, with or without alpha) or BC1/BC2/BC3 (DXT1/DXT3/DXT5), with the legacy header or the DX10 one. Everything opens as U8; the other mip levels are ignored. Cubemaps, texture arrays, volume textures, premultiplied DXT2/DXT4 and other formats (BC4–BC7, float) are refused with CodecError::Unsupported. Writing is not provided.

  • FITS. The image in the primary HDU, or the first IMAGE extension, is read; NAXIS3 = 3 opens as RGB and any other plane count opens the first plane with DecodeWarning::MorePages. Rows follow ROWORDER (bottom-up by default, as Siril and DS9 do). Physical values that fit stay exact as U8/U16 (a camera's BITPIX = 16, BZERO = 32768); the rest become F32, taken as normalised when at most 2 and scaled by 65535 (or the maximum) otherwise. Header cards are kept as text (HIERARCH for long names). Tile-compressed (fpack) files are refused with CodecError::Unsupported; Bayer mosaics open undebayered.

  • DPX. SMPTE 268M frames in either byte order (SDPX, XPDS): the first image element, descriptor 6 (luma), 50 (RGB) or 51 (RGBA), unsigned and unencoded, at 8, 10, 12 or 16 bits. 10-bit data may be packed (0) or filled three to a word (1, method A; 2, method B), 12-bit data packed (0) or one to a 16-bit word (1, method A). 10- and 12-bit code values open as U16 round(c × 65535 / (2^b − 1)), so a frame written back at its depth keeps them exactly. No colour transform is applied: DecodeWarning::DpxEncoding names the transfer characteristic and colorimetric specification, so a log frame is reported as log. More elements than the first give DecodeWarning::MoreElements; the image orientation is applied on import. Writing is big-endian, one unencoded element, at EncodeOptions::dpx_bits (8/10/12/16; by default 8 for U8 and 16 otherwise), packing 1 for 10 and 12 bits; gray with alpha is written as luma. Other descriptors, signed or run-length-encoded data and other bit depths return CodecError::Unsupported naming the field.

  • Cineon (read-only). Kodak's 10-bit logarithmic film-scan format (the one DPX grew from), read from the same Kodak header family: the generic 1024-byte header, big-endian, one (Gray) or three (RGB) channels, three 10-bit samples packed into each 32-bit word, lines on a word boundary. The 10-bit code values open as U16 round(c × 65535 / 1023); the file's black/white reference points are a log-conversion choice and are not applied. A depth other than 10 bits or a channel count other than 1/3 returns CodecError::Unsupported; truncation errors rather than panicking. There is no Cineon writer (ASYMMETRIC_EXCEPTIONS); save as DPX, TIFF or EXR.

  • Camera raw files (DNG, CR2, NEF, ARW… which are TIFF-structured) are recognised and refused with CodecError::Unsupported: they are sensor data, not flat images. photocraft-raw decodes and develops them, and photocraft-io routes them there.

  • HEIF/HEIC (read-only, feature heif). Decoding lives in the optional photocraft-heif crate behind the non-default heif feature (official PhotoCraft builds enable it; distributors choose). Without it, HEIF is still detected and decoding returns CodecError::Unsupported ("HEIC/HEIF support isn't included in this build"). iPhone and Mac photos decode with heic-rs (pure Rust, no unsafe): single pictures and grid-tiled photos, 8 to 12 bits, auxiliary alpha, ICC, EXIF and XMP. The container's irot/imir/clap are applied and EXIF Orientation is rewritten to 1 (HEIF's EXIF tag only repeats the container's, and applying both would turn the photo twice). Grayscale decodes to RGB. Image sequences, overlays and identity derivations, multilayer HEVC and some 4:2:2/4:4:4 streams return CodecError::Unsupported or Malformed, never wrong pixels. Writing needs an HEVC encoder and every mature one is C, so HEIF is listed in ASYMMETRIC_EXCEPTIONS.

  • AVIF. Encoding uses ravif, which is pure Rust. Decoding needs dav1d, which is C. AVIF is therefore read-unsupported, and write support is gated behind the non-default avif feature. In a default build it is neither readable nor writable, so the symmetric guarantee holds. It is listed in ASYMMETRIC_EXCEPTIONS.

  • Lossy WebP. Lossless (VP8L, via image-webp) is the default. webp_lossless: false writes a lossy file with our own clean-room VP8 key-frame encoder (codecs::vp8, from RFC 6386; webp_quality 0–100 on libwebp's scale sets the quantizer). Alpha travels losslessly in an ALPH chunk and ICC/EXIF/XMP in their own chunks of the extended (VP8X) container. The encoder makes no rate-distortion decisions yet, and a side longer than 16383 px (the VP8 frame header's limit) is refused with CodecError::Encode. We read both lossy and lossless files.

  • Animation and multi-page files (APNG, animated GIF/WebP, multi-page TIFF): only the first frame or page is decoded, and a single frame is written. FormatCaps::animation marks containers that can hold more frames. The decoded image then carries a DecodeWarning::MoreFrames / MorePages in Image::warnings, with the total when the file states it (frames and TIFF directories are counted without decoding them; reduced-resolution TIFF directories and transparency masks are not pages). Any TIFF page can still be opened with decode_tiff_page (and photocraft_io::import_tiff_page). Every frame of a GIF comes from decode_gif_frames: each frame composited onto the logical screen with the disposal methods applied, as RGBA8 with its delay in milliseconds, within Limits and MAX_GIF_FRAMES. The video-layer commands use it (photocraft_io::import_gif_frames).

  • EXIF in TIFF is stored as a sub-IFD rather than a blob, so it is not preserved yet. caps.exif = false for TIFF, and a warning is raised.

  • Orientation (EXIF tag 274 in JPEG, PNG eXIf and WebP; the decoded page's tag in TIFF and BigTIFF) is applied on decode, like Photoshop: the pixels come back upright and the EXIF/XMP orientation is rewritten to 1 (DecodeOptions::keep_orientation opts out). Encoders always write Orientation = 1 (upright_exif, upright_xmp, which change only the tag's value, kept in its own type), so upright pixels are never rotated twice. Parsing is strict: an IFD0 inside the 8-byte header or cut off before its next-IFD pointer, an Orientation that is not exactly one SHORT or LONG, or an out-of-range value reads as 1; with duplicate entries the first wins. Limits are checked again on the upright size (5–8 swap width and height), and the rotated buffer is allocated fallibly. Image::oriented turns any layout and depth in parallel bands (about 10 ms for 24 MP RGB8 in release).

  • Resolution (#1691, module resolution): a file without a resolution of its own format (no PNG pHYs, a WebP, HEIF, …) takes it from its XMP tiff:XResolution / YResolution / ResolutionUnit, else from EXIF IFD0 (RATIONAL X/YResolution, unit 2 inch — the default when absent — or 3 cm; unit 1 or anything malformed counts as no resolution). A JPEG uses, like Photoshop, the first usable of: APP13 Photoshop ResolutionInfo (0x03ED), XMP, EXIF, and only then the JFIF density (cameras write EXIF only, many tools write a default JFIF 72). On export the EXIF and XMP resolution are rewritten to the image's (export_exif, export_xmp): the RATIONAL values in place, ResolutionUnit set to 2, an entry that can't be rewritten removed from IFD0 without moving any other data. IFD1 (the thumbnail's) is left as it is.

  • JPEG

    • 8-bit only. Neither decoder backend supports 12-bit.
    • A file cut off inside its image data decodes leniently (a baseline JPEG's missing rows come out grey) but never silently: the image carries DecodeWarning::Truncated. A file that ends before any scan data is an error.
    • CMYK is always written 4:4:4 (subsampled CMYK is not portable) as Adobe-inverted CMYK with an APP14 marker.
    • Text is not written because there is no COM-segment support.
    • EXIF and XMP must each fit in one APP1 segment (65 533 bytes with its header). Metadata that doesn't fit is dropped and the export still succeeds, with a MetadataTooLarge warning ("EXIF (… bytes) is too large for the format; it will be dropped"). Before dropping XMP, the encoder first removes the layered-document properties (DocumentAncestors, TextLayers) that mean nothing in a flat JPEG. Extended XMP is not written.
  • TIFF decode

    • Classic TIFF and BigTIFF (version 43, 8-byte offsets), both byte orders, strips or tiles, planar configuration 1 or 2.
    • Supports 1, 2 and 4-bit gray, 8/16/32/64-bit integers (32 and 64-bit are reduced to U16), F16, F32 and F64 (converted to F32), WhiteIsZero (#691: the tones are no longer inverted), palette images (opened as RGB), associated alpha (made straight) and extra samples (dropped unless the first is alpha).
    • Every directory is reachable: tiff_info lists the main IFD chain and its SubIFDs (tag 330) with each page's size, kind (page, reduced-resolution copy, mask) and storage, walked with a seen-set, a depth limit and a 10 000-directory cap; decode_tiff_page opens any of them. decode opens the first full-resolution page, like Photoshop (thumbnails are skipped).
    • Banded decoding: the image is allocated once at its final size and each strip or row of tiles is decoded straight into it, in parallel on native targets, with at most one strip/tile-sized scratch buffer per worker (30 MP RGB8: Deflate 345 → 32 ms, LZW 428 → 43 ms in release). Image data cut off by the end of the file decodes with DecodeWarning::Truncated; a file far too small for its declared size (more than any compression could expand) is refused before allocating.
    • YCbCr, CIE Lab, signed integers and compressions that the tiff crate lacks (CCITT, JPEG-in-TIFF) return Unsupported.
  • TIFF encode writes classic TIFF, or BigTIFF when EncodeOptions::tiff_bigtiff is set or the file could pass 4 GiB.

  • EXR

    • Multi-part files (a Maya/Arnold render writes one part per AOV) open the part that looks most like a colour image — RGBA beats RGB beats YA beats a single channel, so a depth-only part no longer fails the file — with DecodeWarning::MoreParts naming how many parts exist. exr_info lists every part (name, view, size, channels, deep/tiled) without decoding pixels, and decode_exr_part decodes a chosen one. Deep parts stay with the deep decoder: a file that has any is refused here with a pointer to it.
    • Reads at full resolution, from the data window.
    • Channel names are matched by suffix, so layer.R counts as R.
    • Subsampled channels are unsupported.
    • Cryptomatte layers (specification 1.2, as written by Arnold, V-Ray, Redshift, Mantra/Karma and Cycles) are listed and decoded structurally: cryptomatte_layers reads the header attributes, channels and embedded manifest without pixels, decode_cryptomatte returns the per-pixel (ID, coverage) pairs, and cryptomatte_id/cryptomatte_key/cryptomatte_preview_color hash names to IDs the way the reference implementation does (official test vectors in the test suite).
    • Deep data (scanlines or single-level tiles, compressed NONE, RLE or ZIPS) opens as a flat image: each pixel's samples are composited into one, with DecodeWarning::DeepFlattened because per-pixel depth is not kept. Deep ZIP (16-line blocks) and deep mip-map or rip-map tiles return Unsupported.
    • Only lossless compressions are offered for writing: None, RLE, ZIP1, ZIP16 and PIZ.
  • Netpbm writing picks the subtype from the image: float gives PFM, gray gives P5, RGB gives P6, and anything with alpha or CMYK gives P7 (PAM). Writing a .pbm file therefore produces whichever of these fits the data.

  • Colour conversions (CMYK↔RGB, RGB→gray) are naive. Colour-managed conversion belongs in photocraft-color.

Limits (decompression bombs)

DecodeOptions { limits: Limits { max_width, max_height, max_pixels, max_alloc }, .. } guards decoding. Header dimensions are checked before the pixel buffer is allocated, and the budget is also passed to the underlying decoders. A violation returns CodecError::LimitExceeded. The defaults are 262144 px per side, 2^30 pixels and 8 GiB (2 GiB on 32-bit targets such as wasm). PNG also bounds the aggregate decoded text and XMP (UTF-8 keywords and values) by max_alloc, including chunks after IDAT. This budget is separate from pixels, not a total process-memory cap.

Tests

cargo test -p photocraft-codecs covers:

  • the full round-trip matrix (every writable format × 4 sample types × 6 layouts), exact for lossless formats and above a PSNR threshold for lossy ones;
  • metadata preservation per format, checked against caps;
  • magic-number detection, including negatives;
  • fidelity warnings, and a cross-check that the warnings match the actual round-trip result;
  • the symmetric-capability guarantee;
  • malformed input: truncation, bit flips and proptest random bytes;
  • Adam7 PNG against progressive PNG and against the image crate as an oracle;
  • limit enforcement.

If corpus/pngsuite/*.png exists at the repo root, every file in it is compared against the image crate's decoder. Without it, that test is skipped.