How to install and use optipng on Linux CentOS

CentOS and Linux Stuff: How to install and use optipng on Linux CentOS

If you have some png files that you want to optimise, you can use optipng to do it without losing any data in the image. Here are the commands you need to use to first install optipng, then recursively run it on all png images in a directory

First you must install optipng on your server, with this command:

yum install optipng

Then run it on all png images within the current directory (and all subdirectories)

find . -name "*.png" -exec optipng -o7 {} \;

You should also see my page explaining how to do the same thing but for jpg images

webdevetc profile pic
webdevetc

I am a 29 year old backend web developer from London, mostly focusing on PHP and Laravel lately. This (webdevetc.com) is my blog where I write about some web development topics (PHP, Laravel, Javascript, and some server stuff). contact me here.



More...


Comments and discussion about How to install and use optipng on Linux CentOS

Found this interesting? Maybe you want to read some more in this series?

Or see other topics in the CentOS and Linux Stuff language

Or see other languages/frameworks:
PHP Laravel Composer Apache CentOS and Linux Stuff WordPress General Webdev and Programming Stuff JavaScript
Or see random questions

How to see all of the options for an artisan command?

How to check if a (blade) view file exists

How to force non www in htaccess

How to set up an alias to map one directory to another destination

How to check if two strings are anagrams in PHP?

How to output (echo/print) content in PHP

How to merge/concat two arrays together in JS?

How to block an IP range based on CIDR in Apache with .htaccess

How to disable file hotlinking in Apache with .htaccess

How to hide the server signature (hide Apache info) from HTTP headers with .htaccess