Image Optimization¶
This article explains how to quickly convert a PNG image format to a JPG file format using ImageMagick, a command line tool for editing photos.
Image Format Conversion¶
The following code will convert a PNG into a JPG, which is a compressed image format and more optimized for use on a website.
mogrify -format jpg studio.png
Image Compression¶
The following code will compress the input image by 50% in quality.
convert studio.jpg -quality 50% studio-web.jpg
Results¶
The results below, shown on my computer show the original image file (PNG) was 1.5MB in size, while the final optimized image file (JPG, 50%) is 67KB.
# compress all JPGs to quality 50% width 1000:
mogrify -quality 50% -resize 1000 *.jpg
Image Manipulation¶
Scale image size: 1000px should be enough.
Compression: 50% (more agressive for web)
PNGs are uncompressed (pixel accuracy)
JPGs are compressed (human viewable)
Last update: May 7, 2021