Skip to content

docs: document png alpha and svg metadata behavior - #24

Merged
Kikobeats merged 3 commits into
masterfrom
docs/imgbot-parity
Aug 5, 2026
Merged

docs: document png alpha and svg metadata behavior#24
Kikobeats merged 3 commits into
masterfrom
docs/imgbot-parity

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Aug 5, 2026

Copy link
Copy Markdown
Member

Follow-up to the v0.0.30 fix, which landed on master directly and never got a review pass.

What changed

Two additions to the README:

  1. Pipelines now documents the two lossless transforms introduced in v0.0.30 — the opaque-alpha drop for PNG and the <title>/<desc> whitespace collapse for SVG — including their limits (animated PNGs are skipped, <text> is never touched).

  2. Benchmark gains a head-to-head table replaying microlinkhq/www#2183, an ImgBot PR against a production site, with optimo run on the exact same inputs.

Why the benchmark is trustworthy

The ImgBot column reproduces the percentages from its own PR body byte for byte (-11.02%, -10.84%, -9.38% total), which confirms the fixture set matches what ImgBot actually measured rather than a re-run under different conditions.

optimo now matches or beats ImgBot on all 11 files: -9.51% vs -9.38% overall. The two files that motivated v0.0.30:

  • gmail-bimi-brand-logo.png — carried a fully opaque alpha channel. Every re-encode candidate came out larger than the input, so optimo's safety guard kept the original and saved 0 bytes while ImgBot saved 6.32%. Now -8.50%, ahead of ImgBot.
  • bimi/adobe.svg — kept a literal newline inside <title>. Now at parity, 340 B.

gmail-bimi-brand-logo.png is pixel-identical to its input (magick compare -metric AE reports 0), as are the other eight PNGs. adobe.svg is also 0. magnific.svg is not — it reports 99, because SVGO's preset-default rounds path coordinates. That predates this PR and is now stated explicitly in the README rather than glossed as blanket losslessness.

Note on process

The v0.0.30 fix (5f717b2) was pushed straight to master and released before review. Rewriting that history under a published tag would break v0.0.30, so it stays as-is; this PR is the review pass for the behavior it introduced.

Docs only — no code changes, no version bump.


Note

Low Risk
Documentation-only changes with no code, config, or release impact.

Overview
README-only follow-up that documents behavior already shipped in v0.0.30 (no runtime changes).

Under Pipelines, a new Format-specific lossless behavior section explains PNG opaque-alpha stripping (RGB conversion, animated PNG exception) and SVG <title>/<desc> whitespace collapse (with <text> left alone).

Under Benchmark, a Head-to-head on real assets subsection adds an 11-file table replaying microlinkhq/www#2183 against ImgBot, plus notes that both tools share the same backends, optimo’s aggregate savings, and which outputs are pixel-identical vs magnific.svg’s SVGO path rounding.

Reviewed by Cursor Bugbot for commit 08f4750. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Documentation
    • Documented format-specific lossless optimization behavior for PNG and SVG files.
    • Added real-world asset comparisons with ImgBot, including per-file and aggregate results.
    • Clarified that both approaches use the same underlying tools.
    • Confirmed tested PNG outputs are pixel-identical, while SVG output may vary due to path-coordinate rounding.

Adds the two lossless transforms introduced in v0.0.30 to the pipeline
section, plus a head-to-head benchmark replaying microlinkhq/www#2183
on real production assets.

ImgBot's column reproduces the numbers from its own PR body, which
confirms the fixture set matches what it measured.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LP1pN2cuVgeVJujCnLBD4P
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

README.md documents format-specific PNG and SVG optimization behavior. It also adds a production-asset comparison between optimo and ImgBot, including per-file and aggregate size results and pixel-comparison findings.

Changes

Optimization documentation

Layer / File(s) Summary
Behavior and benchmark documentation
README.md
The README documents PNG alpha-channel handling, animated PNG behavior, and SVG metadata whitespace handling. It adds ImgBot and optimo size comparisons for production assets and describes their shared tools and pixel-comparison results.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the README documentation about PNG alpha handling and SVG behavior, which are central parts of the changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/imgbot-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coveralls

coveralls commented Aug 5, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 31042557369

Warning

No base build found for commit 286802b on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 68.203%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 1323
Covered Lines: 897
Line Coverage: 67.8%
Relevant Branches: 196
Covered Branches: 139
Branch Coverage: 70.92%
Branches in Coverage %: Yes
Coverage Strength: 3.76 hits per line

💛 - Coveralls

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 55: Update the README statements for SVG whitespace handling and the
`magick compare -metric AE` check to distinguish metadata text from rendered
graphics: state that collapsing whitespace in `<title>` and `<desc>` may alter
their text content, while rendered graphics remain unchanged and rendered
outputs are pixel-identical. Do not claim that accessibility-reader text is
unchanged or that the pixel comparison proves SVG metadata equality.
- Line 54: Update the README description of opaque-alpha handling to state that
only opaque-alpha removal is skipped for animated PNGs, while the rest of the
PNG processing still applies.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c683820-5a8d-41cf-9d80-2dc9feb49f32

📥 Commits

Reviewing files that changed from the base of the PR and between 286802b and eda3e80.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md Outdated
Comment thread README.md Outdated
Addresses review feedback on #24.

Animated PNGs are still optimized; only the opaque-alpha removal is
skipped for them. The previous wording implied the whole pipeline
skipped them.

The blanket "every output is pixel-identical" claim was wrong. It was
verified on one PNG and generalized to all 11 files. Re-running
`magick compare -metric AE` across the set shows magnific.svg at 99,
because SVGO's preset-default rounds path coordinates. The nine PNGs
are all 0. The claim now states this per format.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LP1pN2cuVgeVJujCnLBD4P

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 168: Update the SVG comparison statement in the README to say the outputs
are not all pixel-identical, since adobe.svg has zero differing pixels. Replace
“a small number of pixels” with “99 pixels,” matching the reported metric for
magnific.svg.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 952f6ff6-2211-431e-bdcd-c01b848d2057

📥 Commits

Reviewing files that changed from the base of the PR and between eda3e80 and 19be4a4.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md Outdated
Addresses review feedback on #24.

The sentence claimed both SVG outputs differ from their inputs, then
reported 0 differing pixels for adobe.svg in the same breath. Only
magnific.svg differs, at 99 pixels of 2,304.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LP1pN2cuVgeVJujCnLBD4P
@Kikobeats
Kikobeats merged commit 63fb664 into master Aug 5, 2026
3 checks passed
@Kikobeats
Kikobeats deleted the docs/imgbot-parity branch August 5, 2026 20:10
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.

2 participants