#imageMagick #jpeg

Image optimization using ImageMagick

Sample script to search a directory and only downsize pictures larger than 4k: for i in $(find IMAGE_DIRECTORY -iname "*.png" -o -iname "*.jpg"); do echo $i ; mogrify -filter Triangle -define filter:support=2 -resize 3840x3840 \ -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 \ -define jpeg:fancy-upsampling=off -define png:compression-filter=5 \ -define png:compression-level=9 -define png:compression-strategy=1 \ -define png:exclude-chunk=all -interlace none -colorspace sRGB $i ; done An article with more details on image magic image optimization can be found here