* Build: restore designcraft_format::write for recovery; render decodes without naming the image crate
* Build: collapse the nested if in images tone (clippy)
* IDML export: placements in cells and footnotes embed their PDF layer choices
* Tests: Word fixtures carry the document relationships part
* PDF/X-4: untagged WebP images carry sRGB
* Images: CMYK TIFFs with other inks fall back to RGB; associated alpha keeps its inks
craft-image-codecs' TiffPage lists InkSet (storytold/craft-libs#1307), so decode_cmyk_tiff
again refuses InkSet 2 instead of reading other inks as C, M, Y and K. Associated alpha
is made straight by the decoder; the PDF tests check those inks and that alpha.
* PDF tests: CMYK fallback expects the screen's RGB; alpha images read the masked image
The RGB fallback for other inks converts through the working CMYK space, as decode_rgba
does, so the test takes its expected samples from decode_rgba. image_color_samples took the
first image stream, which for an image with alpha is its soft mask.
* Images: repin craft-image-codecs to the InkSet enum (storytold/craft-libs#1307)
* Pin craft-image-codecs to storytold/craft-libs ea1c842 (#1307)
The gate that limits parallel decodes counted each image at its cached
size (4 bytes a pixel and a third more for the smaller levels). A decode
holds more than that while it converts the pixels: an 8-bit image keeps
its RGBA copy beside the decoded or the premultiplied pixels, 8 bytes a
pixel. Two 5,500 pixel square images passed the gate together and could
hold more than half the cache budget at once.
- decode_sizes returns the cached size and the peak size from one size
read. The peak counts the samples as stored beside their converted
copy (designcraft_images::decode_bytes_per_pixel): 8 bytes a pixel for
8-bit color, 10 for 16-bit RGB, 12 for 16-bit CMYK TIFFs and 16-bit
RGBA, 10 for 8-bit CMYKA TIFFs, 15 for 16-bit CMYKA TIFFs, 9 for
PSDs. An EPS counts as its TIFF preview. PDF pages, SVGs and EPS
files without a preview count 8.
- warm budgets the cache with the cached size and gates decodes with
the peak size.
- Every warm call in the process shares one gate, so the canvas
worker, thumbnails and exports together stay within half the budget
while they decode. warm returns the most its own call had decoding.
- An EPS without a preview is sized at the larger of its drawn
PostScript and its placeholder. The placeholder is clamped to 4000
pixels on each side, so a 10,000 by 4,000 point EPS that is not drawn
takes 4000 by 4000 pixels, not the 4000 by 1600 counted before.
The JPEG decoder takes the smallest scale that meets either requested
side. A short side rounds up to the same size at several scales, so a
100 x 2 JPEG asked for at a half decoded at an eighth (13 x 1). The
long side alone now picks the scale, and a decode whose size differs
from the requested reduction is refused, which falls back to the full
decode.
A reduced decode now applies the full decode's size limits before it
reads any image data:
- A file whose size pixel_size cannot read is refused, so the 256 Mpx
check always has a size to compare. The JPEG decoder's own reading of
the frame size is checked against the same limit.
- A progressive JPEG keeps the coefficients of the full-size image until
its last scan, whatever the output size. When those take more than
512 MiB (each component counted at full size, each side rounded up to
32 pixels), the reduced decode is refused and the full decode, with
its own limits, applies.
A placed JPEG drawn at a fraction of its pixel size was decoded at full
size first and then halved down to the level the screen needs. For a
24 MP photo that is a 96 MB decode per image, and with several such
images on a page the decoded pixels outgrow the image cache.
A YCbCr or grayscale JPEG whose wanted level is a half, a quarter or an
eighth of its size (or smaller) is now decoded at that size straight
from its compressed blocks with jpeg-decoder's scaled IDCT, cut to the
size the halving path gives the same level, and halved from there for
smaller levels. The embedded ICC profile is applied as in a full
decode. CMYK and YCCK JPEGs, other formats and the full size still
decode in full.
The RIFF size counts the bytes after its own field, so the container ends at
offset 8 plus the size, not 12. An EXIF chunk that ran up to four bytes past
the declared container was read when trailing bytes followed it. A new test
covers an exact size with and without trailing bytes, a size declared four
bytes short, and a file cut inside the EXIF chunk.
Paste ignored a bitmap on the system clipboard: a screenshot or an image
copied in a browser had to be saved and placed. Paste now places it.
- edit.pasteImage {base64, name?, spread?, at?} embeds the image in the
selected empty frame, or in a new frame centered on `at` at its stored
resolution (72 ppi when none) and at most 60% of the page width, as
File > Place sizes it. Save and reopen and IDML export keep the pixels.
Images over 64 million pixels and names without an image extension are
refused.
- Ctrl/Cmd+V pastes the image egui delivers with no text, and Edit >
Paste reads the clipboard's bitmap, or the first image file of a copied
file list, when there is no text or the text is only an address.
- The menu read waits at most 1.5 s on its own thread, with one read in
flight at a time.
- With a native menu, objects copied here still paste as objects until
the pasteboard's change count shows a newer copy.
- ui.paste takes {image} for the control channel.
Tests read a pHYs chunk behind 100 text chunks in a PNG, ignore a pHYs
after the image data, and read an EXIF chunk stored after 100 frames of
an animated WebP.
A JPEG whose EXIF resolution is 0 ppi or outside 1 to 100,000 ppi now
takes its size from its JFIF density instead of one point per pixel.
Tests place an 11 x 17 in image (330 x 510 px at 30 ppi) with a click,
check that it comes in at 792 x 1224 pt and keeps that size through a
save and reopen, and that an image with no stored resolution comes in
at 72 ppi.
A 600px photo saved at 600dpi places 1in wide, as in InDesign, instead
of one pixel per point. Reads JFIF/EXIF (JPEG), pHYs (PNG), EXIF (WebP),
pixels-per-meter (BMP) and TIFF resolution tags; insane metadata falls
back to 72ppi.
tone() decoded a GIF to RGBA and decode_cmyk_tiff() called read_image()
without the header check decode_rgba() runs. Both now call
too_large_to_decode() first. The decoders' own limits (image 512 MiB,
tiff 256 MiB) already refused these files; the guard refuses them from
the header instead.
With compressImages on, PDF export re-encodes rasters as JPEG in
recompress, which decoded with the image crate directly. A gray PNG
that decode_rgba refuses still decoded there, was copied and encoded
as JPEG, and only then dropped: krilla refuses a JPEG wider or taller
than 16,384 px, and every raster past the budget is. Exporting the
23,000 px PNG that way took 4.2 s and 1 GB more memory, for a PDF
without the image.
recompress now asks too_large_to_decode first, the check decode_rgba
uses, so the export skips the image with the same warning at once.
decode_rgba relied on the image crate's 512 MiB limit, which bounds
only the decoder's own output. A gray or 1-bit image just under it
expanded four times to RGBA, and render made a premultiplied copy on
top: a 288 KB PNG of 23,000 x 23,000 pixels froze the first draw for
9 s and took the app to 4.5 GB. The size is now read from the header
and anything past 256 Mpx is refused before decoding. It draws as an
empty frame, and PDF export skips it with a warning.
A 300 ppi scan of an A0 sheet (about 139 Mpx) still opens.
Pin the final egui, winit and shared UI revisions and reconcile current main.
Preserve document-epoch input and screenshot boundaries, host action ordering,
and Windows path regression coverage. Add click/End batch characterization.
Validation: all nine Linux CI stages pass (3230 tests, zero failures); Windows
CI and bounded native editing workflows pass on the same production source.