Optimage optimizes JPEGs and PNGs by losslessly recompressing them and removing unnecessary metadata (EXIF, comments, etc), making the web faster and your repo smaller.
$ optimage test_data/valid1.png File can be losslessly compressed to 67 bytes (savings: 52 bytes = 43.70%) Replace it by running either:
optimage --replace test_data/valid1.png optimage --output <FILENAME> test_data/valid1.png$ optimage --replace test_data/valid1.png File was losslessly compressed to 67 bytes (savings: 52 bytes = 43.70%)
$ optimage --output /tmp/valid1.png test_data/valid1.png File was losslessly compressed to 67 bytes (savings: 52 bytes = 43.70%)
You can install, upgrade or uninstall optimage
with these commands:
$ pip install optimage $ pip install --upgrade optimage $ pip uninstall optimage
You'll also want to install (note that libjpeg-turbo-progs below is for jpegtran):
$ apt install libjpeg-turbo-progs jpegoptim pngcrush optipng zopfli
Python 2.7, 3.3, 3.4 and 3.5 are supported.
Help for this project is more than welcomed, so feel free to create an issue or to send a pull request via http://github.com/sk-/optimage.
Tests are run using pytest, either with:
$ python setup.py test $ pytest
- Fixed #19: remove --lossy_8bit from zopflipng call
- Fixed #13: temporary files are removed after use
- Added support for Python 2.7
- Added support for zopflipng
- Fixed #4: Images are now considered equal when alpha is 0 regardless of RGB.
- Fixed #6: Add --debug option to gather performance stats
- Initial release with support for (jpegtran, jpegoptim, optipng, pngcrush)