S

Smartu

Zhitu strategy rebuild

CLI

Local image compression with recovered Zhitu strategy.

Smartu keeps the strategy in one package, then exposes it through Node, CLI, and browser runtimes.

Format

Magic-byte detection before extension handling

PNG

alpha, palette, area, color count, and source size thresholds

JPEG

DQT source-quality estimate before recompression

Candidates

PNG/JPEG conversion and WebP outputs only when smaller

Browser runtime

PNG, JPEG, WebP via shared strategy

Loading
Preparing browser runtime

Strategy model

The first implementation target is classification, quality selection, candidate comparison, and replacement safety. Codec details stay behind runtime adapters.

Format

Magic-byte detection before extension handling

PNG

alpha, palette, area, color count, and source size thresholds

JPEG

DQT source-quality estimate before recompression

Candidates

PNG/JPEG conversion and WebP outputs only when smaller

Replacement

local explicit option, skipped unless the primary output shrinks

CLI workflow

pnpm build
smartu ./images --out ./compressed --format auto,webp --recursive
smartu ./images --replace
pnpm benchmark:strategy -- --samples ./samples
--replace

replace original paths only after a smaller primary output is produced

--recursive

recurse into input directories

--format auto,webp

choose one or more output formats

--quality auto

use strategy-selected quality by default

--json

emit machine-readable batch results