Skip to content

v0.23.0

Choose a tag to compare

@github-actions github-actions released this 27 Sep 22:49
· 46 commits to main since this release
0ac48a5

Added

  • PDF output from images (src/io/pdf): a page of each image at its own size; JPEGs embedded unchanged, every other image deflated with PNG predictors and its alpha as a soft mask, streaming. sublime convert a.png b.jpg c.tif scan.pdf merges images into one PDF, a page each. Map in DOCS/formats/pdf.md.
  • PDF to images: a PDF object model (cross-reference tables and streams, object streams, repair of broken cross references) and a page's largest image read to any image format, --page N to choose the page; PDF to JPEG copies an embedded JPEG unchanged.
  • LZW decoding is shared between TIFF and PDF (src/io/lzw.rs).
  • Benchmark pairs png-pdf (against printpdf and lopdf with the png crate) and jpeg-pdf (against lopdf): every line passes.

Changed

  • The binary size budget is raised 2.40 -> 2.55 MB and the WebAssembly budget 1.20 -> 1.30 MB for PDF (the object model, filters, and image reader: about 80 KB).
  • The PNG writer's filtered, deflated row stream is shared (FilteredZlib), so a PDF image stream is the same bytes a PNG's IDAT chunks hold; PNG output is unchanged byte for byte.
  • The PDF reader streams an image under a lone Flate filter a row at a time (inflate, predictor, color, soft mask) instead of holding the stream, its samples, and its pixels: 46 MB against 177 on a 41 MB file, flat pages twice as fast.
  • PDF to JPEG writes the embedded JPEG from the file's bytes without copying it first.