Hand back the pictures a page draws, one by one - #30
Merged
Conversation
go-gfx/gfx v0.15.0 takes its JBIG2 decoder from a fork carrying one fix, offered upstream as dkrisman/gobig2#2: the per-symbol pixel cap defaulted to 4 megapixels, below what real scanned documents contain, and a library could not raise it because the limits are process-global variables. Of 403 JBIG2 streams taken from the /Mask and /SMask entries of public Internet Archive scans, 7 were refused at that default. With the fix all 403 decode, every one bit-exact with poppler's own decoder. The dependency also stops being untagged.
This package could draw a page and nothing else. A page is the wrong unit for two jobs. Getting the pictures out of a document is one, and it is what pdfimages is for. Finding out whether a codec is right is the other, and it is why this is here now. A page is a composition: one image decoded wrongly is averaged away by everything drawn over and around it, so a per-page difference of a few percent says nothing about WHICH image was wrong. That is not hypothetical. v0.12.0 went out drawing scanned pages dark because what was measured was "ink appeared" rather than "the right ink", and a per-page number is what let it through. Images returns each picture with the name the page draws it by, the image filter it was stored in — which the pixels cannot tell you and a codec comparison must know — and whether it is a stencil, whose shape comes back without a colour because the colour is not the image's to know. Forms are followed, as pdfimages follows them: a picture reachable only through one is still a picture the page draws. A document may say a form holds itself, so the walk stops after eight levels. The names are walked in order. A map hands its keys back differently every run, and a list of pictures that reorders itself is not a measurement — that has already cost this repository a day, in a filter table that answered five different ways in eight runs. 100% statement coverage, go vet and -race clean, nine cross-compile targets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This package could draw a page and nothing else. A page is the wrong unit for two jobs.
Getting the pictures out of a document is one, and it is what
pdfimagesis for.Finding out whether a codec is right is the other, and it is why this is here now. A page is a composition: one image decoded wrongly is averaged away by everything drawn over and around it, so a per-page difference of a few percent says nothing about which image was wrong. That is not hypothetical — v0.12.0 went out drawing scanned pages dark because what was measured was "ink appeared" rather than "the right ink", and a per-page number is what let it through.
Imagesreturns each picture with:Forms are followed, as
pdfimagesfollows them: a picture reachable only through one is still a picture the page draws. A document may say a form holds itself, so the walk stops after eight levels.The names are walked in order. A map hands its keys back differently every run, and a list of pictures that reorders itself is not a measurement — that has already cost this repository a day, in a filter table that answered five different ways in eight runs.
100% statement coverage,
go vetand-raceclean, nine cross-compile targets.