Expand description
Image export for a user-facing tool: every image comes out right, or it is reported as skipped with the reason.
crate::images::encode_image_for_document was written for embedding in
office packages and reads only the stream’s filter, first colour-space name
and bit depth. That is not enough to produce a faithful picture, and three
classes came out silently wrong (#616):
- an
/Indexedimage at 8 bits per component was written as greyscale, so the palette indices came out as grey levels; /SMask,/Maskand/Decodewere ignored, so transparency was lost and inverted images stayed inverted;- an Adobe CMYK JPEG was passed through unchanged, which browsers show with inverted colours.
A download button that hands out a wrong picture is worse than one that says
“this one we could not extract”. So export_images expands palettes (small
and exact), and skips everything else it cannot reproduce faithfully, naming
why in SkipReason – including CMYK and non-sRGB ICC images, whose
colours would shift without a colour-managed conversion.
Structs§
- Exported
Image - An image that was exported as a faithful PNG or JPEG.
- Image
Export - The result of
export_images. - Skipped
Image - An image that was left out because it could not be exported faithfully.
Enums§
- Skip
Reason - Why an image was skipped rather than exported.
Functions§
- export_
images - Export every image XObject on every page, each once, as PNG or JPEG.