DEV Community

Darragh O'Riordan
Darragh O'Riordan

Posted on • Originally published at darraghoriordan.com on

Easiest way to optimise images for web

Here is how I optimise all pngs and jpgs in a folder for publishing to the web.

To get the tools install with brew or whatever you use.

brew install imagemagick optipng
Enter fullscreen mode Exit fullscreen mode

Then run the following commands to produce optimised images for web sites. This will often reduce the size of the image by 50% or more with no obvious loss of quality for web.

# for jpgs
mogrify -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% *.jpg

# For pngs and bitmaps
optipng *
Enter fullscreen mode Exit fullscreen mode

Top comments (0)