Smartu
Zhitu strategy rebuild
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
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--replacereplace original paths only after a smaller primary output is produced
--recursiverecurse into input directories
--format auto,webpchoose one or more output formats
--quality autouse strategy-selected quality by default
--jsonemit machine-readable batch results