Image optimization

Yesterday there was a whole thread on Mastodon about image optimization and a lot of people pitched in with their techniques. I am intimidated by the options offered by imagemagick and never know how to use it effectively to achieve results other than a simple resize. Its a good thing that knowledgeable folks had already done the hard work and I picked up some handy commands to convert into monochrome and run jpgquant optimization. One python application stood out among these. Lid. I liked the simplicity of options to work with the images to achieve a lo-fi result. The error diffusion especially. Here’s my coffee mug through the lid and after a size reduction in imagemagick. All of 128KB.

Here’s the original (2 MB) and final (128 KB) image file size:

The error diffusion option is not the most optimal solution but I love the look of it.

And here’s the imagemagick magic to reduce the file size. I learned about the -strip option that removes the metadata info from an image.

convert -auto-orient image3.jpg \
	-resize 700 \
	-quality 70 \
	-strip image4.jpg

Day 55 - Join Me in #100DaysToOffload

Related posts

Optimization Prime

This blog is hosted on a Raspberry Pi and one of my aims is to keep it as light as possible. That involves keeping a clean HTML and CSS without…