Created
December 23, 2017 14:35
-
-
Save nilesolutions/a30abc4db5e45112cb97df226ca63995 to your computer and use it in GitHub Desktop.
Use ‘optipng’ to optimize/re-compress your png images losslessly!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OptiPNG is a useful tool to compress png images without loss its quality, it really help reduce the bandwidth, diskspace and the loading/response time for website. I used it to re-compress all the png images on cdnjs and successfully made 206857 images smaller(see cdnjs/cdnjs@e936c87e9044fd2b123). | |
It’s easy to use, you can install it via apt-get, or download and build it from source : | |
$ sudo apt-get install optipng | |
Usage: | |
$ optipng example.png | |
The default compress level is 2, the range is 0~7 (may depends on the version you are using), I will always use the highest and slowest level: | |
$ optipng -o7 example.png | |
Find all the png images to compress: | |
$ find path -name "*.png" -exec optipng -o7 {} \; | |
In fact, optipng can convert BMP, GIF, PNM and TIFF format image to optimized optimized png, and also performs PNG integrity checks and corrections, very nice. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment