Skip to content

🐞 Darken tiled scans in PDF viewer dark mode - #227

Merged
lindsey-pony[bot] merged 1 commit into
mainfrom
g4-flitter-scan-contrast
Nov 16, 2026
Merged

lindsey-pony[bot] merged 1 commit into
mainfrom
g4-flitter-scan-contrast

Conversation

@JFWooten4

Copy link
Copy Markdown
Member

Problem

The 1992 GAO securities-investor-protection report is a dark-mode regression candidate: scanned black-on-white pages can remain bright with the default Preserve image colors option enabled. The previous detection required one image to cover at least 80% of a PDF page; multiple image tiles that jointly fill a page were not recognized as a scan, so the original white images could be overlaid on the inverted canvas.

Changes

  • Determine combined page coverage with a 20×20 sample grid using the PDF.js image coordinates, counting overlapping areas only once.
  • Treat an aggregate image coverage of at least 80% as a scanned page, suppressing the color-restoring image overlay so the dark-mode page inversion remains visible.
  • Preserve the existing fast path for one page-sized image and the original colors of smaller photographs and illustrations.
  • Add regression tests for one-page scans, tiled scans, overlapping images, and independent illustrations; register the new tests in the appearance suite.

Verification

  • Seven synthetic geometry scenarios were exercised and passed before committing.
  • Verified that the new commit changes four intended files compared with its parent and contains the intended implementation and test additions.
  • The complete Node test suite and an interactive Chrome rendering check against the GAO PDF have not been run in this environment. The PDF itself could not be downloaded for binary inspection, so this fix addresses the identified tiling blind spot rather than claiming to prove the GAO document uses tiled images.

Manual regression

Open the GAO PDF in the extension with Dark mode and Preserve image colors enabled; confirm scanned page backgrounds darken. Then check a document with separate color photographs, light mode, and the setting disabled.

Write PR descriptions automatically.

Count the combined on-page coverage of image tiles before restoring their original colors. This allows black-and-white scanned documents split into smaller images to darken as intended, while preserving ordinary illustrations. Add targeted regression coverage.

Co-authored-by: ChatGPT 6 <noreply@openai.com>
@lindsey-pony
lindsey-pony Bot merged commit 6626a5a into main Nov 16, 2026
14 checks passed
@lindsey-pony
lindsey-pony Bot deleted the g4-flitter-scan-contrast branch November 16, 2026 17:54
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