v0.2.0
imageopt — cross-platform image optimizer (CLI + GitHub Action)
A fast, reliable, single-binary image optimizer in the spirit of ImageOptim —
optimizes JPEG, PNG, GIF, WebP and SVG in place, reports how much space was
saved, and is built for CI automation. No runtime dependencies; all codecs are
compiled in.
Highlights
- Lossless by default, opt-in lossy (
--lossy/-q). - Safe to run on every push: lossless is deterministic and idempotent, and
lossy now converges after one pass (see--min-savingsbelow), so a
commit-back workflow won't keep rewriting or degrading images. - Never corrupts or enlarges a file: every re-encode is re-decoded and
validated, the smallest valid result wins, and writes are atomic. - Cross-platform prebuilt binaries: macOS (arm64/x64), Linux (x64/arm64),
Windows (x64), each with a SHA256 checksum.
What's new in 0.2.0
--min-savings <PERCENT>— only rewrite a file if it shrinks by at least
this much.--lossydefaults it to 10% so repeated runs converge instead
of slowly degrading images; pass--min-savings 0for one-shot max squeezing.
Exposed on the Action as themin-savingsinput.- The savings gate is enforced for any smaller candidate even with
--keep-larger. ⚠️ Breaking (library API only): adds a public field toOptimizeOptions
inimageopt-core; hence the 0.2.0 minor bump. No change for CLI or Action
users.
Use the Action
- uses: actions/checkout@v4
- uses: newmatik/image-optimizer@v0.2.0
with:
paths: "src/assets"
recursive: "true"
# optionally commit the result back, or add `check: "true"` to gate a PRInstall the CLI
Download the binary for your platform from the assets below, or build from source
(cargo install --path crates/cli). Licensed GPL-3.0-or-later.