Web-friendly images with ImageMagick

Before uploading images to my blog or AI Tales, I run them through ImageMagick to resize and convert them to “web-friendly” JPGs:

convert -format jpg \                                
    -strip \       
    -interlace Plane \
    -set filename:base "%[basename]" \
    -quality 50% *.png \
    "%[filename:base].jpg"

The command converts all PNG images in a folder to JPG while preserving the filename. Even though quality is set to 50% (you can of course experience with this, I often don’t see a noticeable difference from the original — especially for images generated with AI such as Stable Diffusion.

And the size is reduced significantly. For example, I can sometimes reduce the size of PNG images by more than 90% (553kb to 39kb i a recent example).

Here are some more ImageMagick one-liners.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.