
Magick mogrify -strip -quality $quality *.jpgĪn example usage. Magick mogrify -strip -quality %quality% *.jpgĪn example usage: img-optimize.cmd C:\Users\winuser\Desktop\Pics To learn more, see the ImageMagick mogrify docs. Variables size and quality should be set to your liking.įor quality, it’s a number between 1 and 100. They take one argument: an absolute path to a folder of images.

The Windows and Mac versions of the script are below. I’ve also scripted this so that I don’t have to run multiple commands. Thankfully, ImageMagick makes this easy with *: magick mogrify -format jpg *.png pngīut what if I need to work on multiple images before posting them? Running the above for each individual image would be time consuming. In my case, the page content’s max width 800ish px, so images larger than that don’t have much benefit.įor a single image, I’d typically run the below to convert it from PNG to JPEG, resize it (the aspect ratio is preserved by default), and reduce its quality: magick mogrify -format jpg. In a nutshell, you want to resize your images to support the largest device that would view them (say, a desktop), but no larger.

Then there’s this idea of serving scaled images. So if it makes sense in your case, convert images to JPEG.
#Imagemagic jpg optimize software#
This many-featured, open-source software is a solid tool for doing just that.Īccording to the google developers documentation on optimizing images, compressing JPEGs removes visual details of the image, but the compression ratio can be 10x larger than GIF or PNG. Images often account for the majority of page size, so by making them smaller, you reduce page load times. Update: I now use Hugo’s Image Processing feature for image optimization.
