Kilian / Trimage

A cross-platform tool for optimizing PNG and JPG files.
http://trimage.org
MIT License
706 stars 55 forks source link

Overwriting better compressed images #1

Closed bobwallis closed 14 years ago

bobwallis commented 14 years ago

Trimage's output image overwrites the original one even if the the output image is larger than the original.

Kilian commented 14 years ago

This is one of the features we want to implement in the future. Patches welcome ;)

bistory commented 14 years ago

The simplest solution isn't to remove the --force option from optipng command ? I think people don't care to know if the file is bigger than before, they just care if they won a few Kb's

Kilian commented 14 years ago

It's slightly more complicated. OptiPNG sets a "compressed" flag regardless of the file being completely compressed or not. So in order to "recompress" (to gain a few extra Kb) we have to use the --force option. Sometimes this works adversely.

The way the patch will have to work is by doing a dry-run first, checking the filesize, and only running it properly if the file is smaller.

Kilian commented 14 years ago

Fixed by bistory in version 1.0.5! :D