designcraft/crates
jahala bbe234aaa6
PDF: a damaged PNG, GIF or WebP is skipped, not fatal (#147)
A placed PNG, GIF or WebP that is cut off (an interrupted download) or
has a bad checksum made the whole PDF export fail with
"PDF writer error: Image(Image(ImageRepr {..}), None, "unexpected end of
file")", which names no file. A damaged TIFF or BMP in the same place is
skipped with the warning "image `name` could not be decoded and was
skipped", and the rest of the document is exported.

The exporter decides whether an image can be embedded by asking krilla
to open it. krilla opens PNG, GIF and WebP lazily: it reads the header,
accepts the file, and decodes the pixels only when the PDF is written,
where an error ends the export. TIFF and BMP are decoded by us first, so
they took the skip path.

lossless() now decodes the image first for every format. A file that
does not decode returns None and takes the existing skip-with-warning
path. This costs one extra decode per PNG, GIF or WebP asset: the sample
magazine (two PNGs, 820 KB) exports in 0.19 s instead of 0.17 s in a
debug build.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-10 01:50:29 -04:00
..
color Never crash: geom and color return or fall back instead of panicking 2026-10-04 11:39:33 -04:00
compose Compose: don't panic when a hyphenated paragraph starts with a no-break letter (#115) 2026-10-10 01:09:36 -04:00
doc PDF/A keeps placed images; right-to-left tables and columns (#128) 2026-10-10 01:13:48 -04:00
engine Fonts: the Document Fonts folder is found whatever its case (#287) 2026-10-10 01:14:43 -04:00
epub Security: escape HTML and EPUB metadata (#152) 2026-10-10 01:14:22 -04:00
fonts Images: set SVG text in the shared fonts when the bundled ones lack it (#116) 2026-10-10 01:13:17 -04:00
format Text: missing glyphs show as boxes 2026-10-07 10:44:46 -04:00
geom Never crash: geom and color return or fall back instead of panicking 2026-10-04 11:39:33 -04:00
idml Merge origin/main into data-merge 2026-10-07 22:28:15 -04:00
images Images: set SVG text in the shared fonts when the bundled ones lack it (#116) 2026-10-10 01:13:17 -04:00
mcp CLI: export options after the last export are an error; MCP and README docs match the code (#127) 2026-10-10 01:13:42 -04:00
pdf PDF: a damaged PNG, GIF or WebP is skipped, not fatal (#147) 2026-10-10 01:50:29 -04:00
render Merge remote-tracking branch 'origin/main' into feat/cjk-and-fonts 2026-10-07 22:04:42 -04:00
textimport Word import: keep tracked moved text (w:moveTo) (#257) 2026-10-10 01:14:27 -04:00
tools Snap: snap preferences as a command, overlay colours from tokens, tidy-up 2026-10-06 09:05:59 -04:00
ui-egui UI: the Control panel shows its second row (#142) 2026-10-10 01:50:23 -04:00