Skip to content

Add layer overlap diagnostics#25

Open
sjquant wants to merge 4 commits into
mainfrom
w1c-layer-overlap
Open

Add layer overlap diagnostics#25
sjquant wants to merge 4 commits into
mainfrom
w1c-layer-overlap

Conversation

@sjquant

@sjquant sjquant commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Why

Suspicious visual overlaps need a diagnostic signal so generated specs can be repaired before rendering, without flagging compositions that only overlap in bounding boxes or transparent pixels.

Changes

  • Add layer-overlap diagnostics from measured layer geometry and render order.
  • Use bounding-box overlap as a broad-phase filter, then measure actual visible alpha-mask intersection for text, images, SVGs, and shape layers.
  • Report both bbox_overlap_pct and visible_overlap_pct with overlap pixel counts and a concrete move suggestion.
  • Preserve a fast path for simple opaque rectangles.
  • Allow text fully contained on a lower backdrop while flagging text/text, substantial partial overlaps, complete non-backdrop coverage, and non-text layers covering text.
  • Cover text/text, text/backdrop, partial overlap, ellipse corner false positives, transparent PNGs, glyph holes, full coverage, non-overlap, touching edges, invisible layers, and grouped layers.

Validation

  • uv run ruff check quickthumb/_diagnostics.py quickthumb/canvas.py tests/test_diagnostics.py
  • uv run pytest tests/test_diagnostics.py -q passes: 45 tests.
  • uv run pytest reports 693 passed, 24 skipped, 52 inline-snapshot teardown errors in rendering snapshot tests, and one external httpbin.org 503 failure in test_snapshot_url_image_background_basic.

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