Skip to content

Say when a /Decode array shaped a picture - #32

Merged
tannevaled merged 1 commit into
mainfrom
image-decode-array
Aug 29, 2026
Merged

Say when a /Decode array shaped a picture#32
tannevaled merged 1 commit into
mainfrom
image-decode-array

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

A picture and the same picture as another tool extracts it can be exact complements of each other for a reason that is not a disagreement. /Decode maps the stored samples onto the range the colour space wants; this applies it, as a viewer must, and pdfimages writes the samples as stored.

On a one-bit mask a /Decode of [1 0] therefore inverts every pixel. Judged against pdfimages over a corpus of scanned medical pages, 8 of 23 JBIG2 masks differed at exactly 1.0000 — every pixel — and the pages they are on differ from poppler's rendering by a median of 0.0000. Nothing was wrong except the comparison.

Of the 248 JBIG2 masks on those first pages, 22 carry /Decode [1 0]. All 22 are soft masks; not one of the 194 stencils carries one.

So a picture now says whether an array shaped it — the one thing a comparison needs in order to tell that case apart from a real one.

100% statement coverage, go vet and -race clean, nine cross-compile targets.

A picture and the same picture as another tool EXTRACTS it can be exact
complements of each other for a reason that is not a disagreement. /Decode maps
the stored samples onto the range the colour space wants; this applies it, as a
viewer must, and pdfimages writes the samples as stored.

On a one-bit mask a /Decode of [1 0] therefore inverts every pixel. Judged
against pdfimages over a corpus of scanned medical pages, 8 of 23 JBIG2 masks
differed at exactly 1.0000 — every pixel — and the pages they are on differ
from poppler's rendering by a median of 0.0000. Nothing was wrong except the
comparison.

Of the 248 JBIG2 masks on those first pages, 22 carry /Decode [1 0]. All 22 are
soft masks; not one of the 194 stencils carries one.

So a picture now says whether an array shaped it, which is the one thing a
comparison needs in order to tell that case apart from a real one.

100% statement coverage, go vet and -race clean, nine cross-compile targets.
@tannevaled
tannevaled merged commit bc091ab into main Aug 29, 2026
1 check passed
@tannevaled
tannevaled deleted the image-decode-array branch August 29, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant