Skip to content

perf(markdown): retro-optimize committed example PNGs (1.1MB -> 0.4MB) - #46

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/markdown-renderings-2a-leftovers
Aug 20, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/markdown-renderings-2a-leftovers

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Workspace half of PyAutoHands#247.

Scripts Changed

None. No file under scripts/ or notebooks/ is touched — this PR changes only the committed output images under markdown/, so no notebook regeneration applies.

What

generate_markdown.py's optimize_pngs() is forward-only: it only sees the render in progress, so pages committed before it shipped keep their original PNGs. This puts 31 already-committed images through that exact same 256-colour quantize + optimized encode, using the new --optimize-only retro pass.

1.1 MB → 0.4 MB (0.8 MB reclaimed).

Because it reuses the same function rather than a one-off pngquant sweep, these bytes are identical to what a future re-render of the same pages would emit.

Verification

  • Every PNG under markdown/ is now mode P; changed-file count matches the unoptimized count exactly.
  • git status confirmed only markdown/**/*.png modified — nothing outside markdown/.
  • Dimensions unchanged. A 29-pair before/after pixel diff across the corpus put the worst case at 2.69% of pixels differing by >3% intensity — quantize dithering on smooth colormap gradients.
  • Pages spot-checked as rendered images: colorbars, tick labels and residual structure all legible.

Notes

This shrinks the working tree and future clone-of-tip, not .git history — the original blobs remain in the pack. No history rewrite is proposed.

Upstream PR

PyAutoLabs/PyAutoHands#248 — adds the --optimize-only flag this PR's contents were produced with. Library-first merge gate: that PR must merge before this one.

🤖 Generated with Claude Code

1.1MB -> 0.4MB (0.8MB reclaimed), via the new
`generate_markdown.py --optimize-only` retro pass (PyAutoHands#247).

These pages were rendered before optimize_pngs() shipped, and that function is
forward-only — it only ever sees the render in progress. This puts the already
committed images through the exact same 256-colour quantize + optimized encode,
so these bytes are identical to what a future re-render would emit.

Dimensions unchanged; a 29-pair before/after pixel diff put the worst case at
2.69% of pixels differing by >3% intensity, i.e. quantize dithering on smooth
colormap gradients. Working tree and future clone-of-tip only — the original
blobs remain in git history.

PyAutoHands#247

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 20, 2026
@Jammy2211
Jammy2211 merged commit 8e2ad02 into main Aug 20, 2026
7 checks passed
@Jammy2211
Jammy2211 deleted the feature/markdown-renderings-2a-leftovers branch August 20, 2026 18:56
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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