I have lots of images in png format (over 250k+ png). Properly formatting and compressing png images can save many bytes of data. How do I compress and optimize png images on my amazon cloud account so that I can save bandwidth on cloudfront cdn account?
How do I use an image compressor to create lossless compression on PNG files, with no effect on image quality in bulk using Red Hat Enterprise Linux bash shell?
The following image format is recommended and used by big web sites such as Google / Yahoo / Amazon / Facebook etc:
You need to use a tool called optipng. It is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections. This tool can be installed on any server powered by Unix or Linux operating systems.
Any commands with a # at the start means “as root”.
Type the following yum command to install optipng:
# yum install optipng
On debian and derivatives type in terminal:
# apt-get install optipng
The syntax is:
To display png image size, type, and compression info, enter:
$ pnginfo -t test.png