mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-06 02:21:45 +00:00
* fix(optimize): make pictures under a stencil mask smaller An image with any /Mask was skipped by the colour and grey settings. That is right for a colour-key mask, which names sample values that resampling and JPEG would change. A stencil mask is an image of its own, with its own resolution (ISO 32000-2 8.9.6.3), so the picture can change under it and the mask stays as it is. Some exporters put one on every picture, even where it hides nothing, so whole drawing sets of pictures were left at full size. A mask that can't be read as a stencil, such as a reference to nothing, still leaves its picture alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(optimize): only a mask that says /ImageMask true counts as a stencil A stream /Mask without /ImageMask true let its picture be replaced, although a mask that isn't a stencil is meant to leave its picture alone. It now does. The stencil test also checks that the hole still shows what's behind it. The first pixel all round is left out, because the coarser picture blends into it a little (at most 26 of 255 in this test). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(optimize): draw a coloured page behind the stencil test's picture On a white page, a hole painted white looks the same as an open hole, so the check on the hole couldn't tell them apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: quincy-jc <184324679+quincy-jc@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>