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 select all rows for a certain month (or day, year or time), using Eloquent

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

Push vs Pop vs Shift vs Unshift

Remove trailing slash (redirect to remove trailing slash) in .htaccess

How to merge/concat two arrays together in JS?

How can you check if a variable is alphanum (alphanumeric, letters and numbers only) in PHP?

How to Extract Query String (from a URL) Into an Associative Array in PHP

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

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

What are Template literals (Template strings) in JS?