Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

yumeyao/pngoptim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Status (2025): Obsolete

Historical reference only. Use ECT for a one-shot ultimate solution.

Why obsolete? PNGOptim orchestrates PNGOUT/Zopfli in heuristic passes; ECT uses Zopfli with the BT match finder from 7-Zip's Deflate, effectively closing the gap where Zopfli underperformed.

However PNGOptim can still possibly speed up the process by only selecting proper zopfli --filters but that's usually not a great advance given our PCs are much faster than before.

References

Note on CgBIHelper (previously undocumented): Converts between standard PNGs and iOS CgBI PNGs. CgBI adds a private CgBI chunk, stores raw DEFLATE in IDAT (no zlib wrapper), and uses BGRA + premultiplied alpha. To optimize, re-wrap IDAT in zlib and leave pixels unchanged to get a valid (if visually wrong) PNG that standard tools can recompress.

PNGOptim

PNGOptim is a CMD Batch file (Why?) for optimizing PNG files, aiming at good quality(small file size) with less effort(less tries hence runs faster).

It's inspired by similar projects such as ImageOptim, Trimage, etc.. However, PNGOptim doesn't follow all other projects' brute way, instead it only uses PNGOut and Zopflipng (Why?) in a smart way.

PNGOptim runs generally faster and the output is generally smaller because it's SMART not BRUTE.

FEATURE

  • Multi-CPU ready
  • Smart approach(not brute)
  • Multi-Files at one time
  • Safe for multiple instances

Usage

  1. Download the batch file (you can right-click and choose save).
  2. Ensure you have a copy of PNGOut, Zopflipng and DeflOpt and they are accessable(you can just put the exe files to the same directory as the batch file)
    As a respect of the authors, I DON'T contain the exe files in this project
  3. Now use it to optimize PNG files. They are optimized in-place.
  • Drag'n'Drop PNGs to the batch file or d'n'd folders.
  • Use the syntax "pngoptim pngfile1 pngfile2 pngfile3 pngfile4 ...".
  • Just run the command to see more syntax.

Limit

  1. On XP Home/2000, wmic is not present, assuming 2 logical CPUs.
    • Search for "InitParallel 2" and replace 2 in case you want to change the numbers on such OSes.
  2. Unicode paths that is not valid in current code page fails.
  3. As the sychronization is file-based. There is an astronomically small chance the synchronation goes broken if you run multiple instances at the same time.
    However it's not recommended to run multiple instances and it's not needed, you doesn't benefit from doing so.

TODO

  1. log in verbose mode.

About

pngoptim

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors