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 check if a object has a static variable defined?

How to check if two strings are anagrams in PHP?

How to reverse htmlentities() / What is the opposite of htmlentities()?

What are the main error types in PHP

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

How to set infinite execution time in a PHP script

How to check if a string contains a certain substring?

How to redirect your website to a new domain/location in .htaccess

How to autoload helper files with composer?

How to convert a string to an array of it's characters in PHP?