[#78] Line-quality Phase 3: auto-supersample flat low-res illustrations + --hires + flat economy#79
Merged
Merged
Conversation
…ns + --hires + flat economy The "looks lower-resolution" gap (forensically confirmed) is the native pixel-grid trace: low-resolution flat cartoons (e.g. a 640px JPEG) staircase because curves are fit on the native grid. Supersampling the mask (large viewBox kept; never coord-rescale) fixes it. - pipeline.py: AUTO-supersample the flat low-res illustration class (_supersample_candidate) to _SUPERSAMPLE_AUTO_RES=1536; new ConvertOptions.hires / --hires forces it on any color input. When supersampling, uncap the region merge (_SUPERSAMPLE_REGION_MAX_PX=20000) so the high-res path blow-up is consolidated, and apply a SSIM-gated global same-fill merge. - postprocess.global_same_fill_merge: hoist same-fill fragments into one compound path per fill (lossless flat-region economy; the supersample fragments a clean region into many same-fill tiles). SSIM-gated by the caller (textured/overlapping art fails it and keeps the un-merged trace). Plus the resolution-aware auto-precision lever in smooth.py (lossless bytes). - cli.py: --hires flag. Effect (vs native): pigeon 235->545p, SSIM 0.872->0.892, crisp smooth lines (was staircased); logo 31->220p, SSIM 0.951->0.972. ONLY the flat <1024 class changes — every other input is byte-identical (verified on the 23-image harness); gradients/photos/high-res/textured untouched. Textured stays native unless --hires (where the same-fill economy correctly fails the SSIM gate). Cost: ~2x paths/bytes and slower (2 supersampled traces) on that class. Full suite + corpus goldens green; ruff clean; tests for auto/gated supersample + global_same_fill_merge. 0.5.1 -> 0.6.0. Fixes #78 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…time ~half) At supersample resolution the sharper black core makes the colour tracer carve MORE near-black edge tints, so the snap's cleaner-guard rejects it and falls back to the base trace anyway — the snap_pre render was a full second high-res trace paid for nothing. Gate snap_black on `not did_supersample`. Output is byte-identical (md5-verified pigeon 545p/162KB, logo 220p/65KB); time pigeon 16.9s->9.4s, logo 8.3s->4.9s. Native inputs still get the dark-snap (c_15 etc. unchanged). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes #78. Version 0.5.1 → 0.6.0. Auto-supersamples the flat low-res illustration class (the native pixel-grid staircase that read as 'lower resolution') for crisp smooth lines, with a same-fill economy + lossless auto-precision to keep it economical, and a --hires force flag. ONLY the flat <1024 class changes (pigeon 235→545p SSIM 0.872→0.892 crisp; logo 31→220p) — every other input byte-identical (23-image harness); textured/gradient/photo/high-res untouched. Cost: ~2× paths/bytes + slower (2 supersampled traces) on that class. Corpus goldens + full suite green, ruff clean, tests added. No competitor names anywhere.