Processing images for a website
October 4, 2020•90 words
I always seem to forget the best options for converting eg a photo I’ve taken - or downloaded from Unsplash - for use on a website. Here’s a reminder, based on general experience and also the answers and notes for this StackOverflow question. The basic answer is:
- Crop if necessary, so the image is the right aspect ratio (GIMP does this fine)
- Use
imagemagick
to compress etc, with a command like:
convert input-image.jpg -sampling-factor 4:2:0 -strip -quality 85 -resize 800 \
-interlace JPEG -colorspace RGB output.jpg