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 do comments in Blade files?

How to set infinite execution time in a PHP script

How to exclude URLs from the Laravel CSRF protection?

How to check if a relation was loaded on an Eloquent model already?

What is the null coalescing operator in PHP7?

What is Bubble sort, and how to write an implementation of it in PHP

How to merge/concat two arrays together in JS?

How to access the Laravel's route parameters outside of the controller?

What are the predefined variables in PHP?

What are some ways you can log debug messages and data in JS?