feat(detect): Handle rounded-rect redactions and nearly-unicolor bars#198
Open
mlissner wants to merge 5 commits into196-skip-white-on-white-redactions-20260326from
Open
Conversation
This PDF uses rounded rectangles (lines + bezier curves) with slight color variations for its redaction bars, exercising both the rounded-rect fallback and the nearly-unicolor pixmap check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two changes to catch more bad redactions: 1. Fall back to drawing["rect"] when a drawing has no "re" items. Some tools draw redaction bars as rounded rectangles using lines and bezier curves instead of the "re" command. 2. Replace strict pixmap.is_unicolor with _is_nearly_unicolor(), which checks interior pixels (excluding a 1px border) within a tolerance. Some PDFs render solid bars as two nearly-identical colors (e.g., RGB(34,31,31) vs RGB(35,31,32)). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
inspect-pdf.py dumps redaction-relevant PDF structure (drawings with fill colors and item types, annotations, text spans). debug-pipeline.py walks x-ray's detection pipeline step by step, showing what gets kept/dropped at each stage with pixmap color analysis for filtered entries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
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.
Summary
drawing["rect"]when noreitems existpixmap.is_unicolorwith_is_nearly_unicolor(), which checks interior pixels within a tolerance of 5 per channel, excluding a 1px border where rendering artifacts appeartools/inspect-pdf.pyandtools/debug-pipeline.pyfor investigating PDFsTest plan
test_near_black_redaction_barsverifies detection on a real-world PDF with rounded-rect redaction bars🤖 Generated with Claude Code