tjko / jpegoptim

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

Fix logging to stdout instead of stderr while using --stdout. #114

Closed Eta0 closed 1 year ago

Eta0 commented 1 year ago

Refactoring the optimize code in version 1.5.0 and the removal of the LOG_FH macro caused a regression where certain stats and debug statements are always printed to stdout, even if it is being used for output with the --stdout flag. In particular, when --stdout is used without --stdin (so reading from a file, outputting to a stream), every log is sent to stdout and intermixed with the image data, so jpegoptim image.jpg --stdout > image-opt.jpg produces broken files.

This patch fixes those cases by bringing back the LOG_FH macro.

tjko commented 1 year ago

Thanks for the fixes.