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

Why should you update APP_URL from from http://localhost?

How to disable file hotlinking in Apache with .htaccess

How to Force www or non-www in htaccess

How to do comments in Blade files?

Point all requests to one PHP file

How to use subdomains as parameters in your routes (or in your web.php file)

How to check if a object has a static variable defined?

How to manually write your own pagination in PHP

What is the difference between ( for ... in ) and ( for ... of ) in javascript?

How to sort an array in javascript?