tjko / jpegoptim

jpegoptim - utility to optimize/compress JPEG files
http://www.iki.fi/tjko/projects.html
GNU General Public License v3.0
1.56k stars 116 forks source link

Image larger #66

Closed ghost closed 2 years ago

ghost commented 5 years ago

I use php to execute a shell script: shell_exec("jpegoptim --max=$quality --strip-all --all-progressive - < ".escapeshellarg($path_to_file));

The file gets bigger in bytes, how can I fix that? I use this image. Image

tjko commented 4 years ago

This shouldn't happen if you "optimize" a file directly on disk (instead of feeding the file to jpegoptim via STDIN)?

Sometimes (with certain command line option combinations) jpegoptim may be unable to produce smaller file than the original input file. If you are optimizing a file on disk, jpegoptim will skip the file if that happens, but when using stdin/stdout then it's left up to the calling program to check if the optimized file is indeed smaller or not....