<- Back


Image modification
magick mogrify -auto-orient -strip -resize "1920x1920>" -quality 85 *.jpg
Remove first pixel row
magick convert input.png -chop 0x1 output.png
Convert to webp
magick convert -auto-orient -strip -resize "600x600>" -quality 75 -define webp:method=6 -define webp:use-sharp-yuv=1 image.jpg image.webp
Batch processing
for i in *.jpg; do magick convert /* your options */ $i ${i/.jpg/.webp}; done
Preserve timestamp
magick mogrify -define preserve-timestamp=true <filename.jpg>
Iterate big files
find . \( -iname "*.jpg" -o -iname "*.jpeg" \) -type f -size +1500k -exec magick mogrify [...] {} \;
Image information
Quality of jpeg
magick identify -format '%Q' <filename.jpg>
Exif tags and general info
magick identify -verbose input.jpg
Signature hash of image (pixels only, metadata is ignored, see links below)
magick identify -format %# input.jpg
Create gif
magick convert -delay 30 -loop 0 -resize 50% *.jpg animation.gif
Color reduction
Reduce colors
magick convert input.png +dither -colors 16 output.png
magick convert input.png -posterize 8 output.png
Diff image
Show differences in red
magick compare image1.png image2.png -compose src diff.png
Subtract image
magick composite image1.png image2.png -compose difference diff.png
Convert images to pdf
magick convert *.jpg -auto-orient output.pdf
Convert .svg to .ico
magick -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
Specify sizes
-define icon:auto-resize=16,24,32,64
Convert .svg to .png
magick -density 128x128 -background transparent favicon.svg -resize 192x192 favicon.png
Check generated .ico file
icotool --list favicon.ico
Reduce size of svg or png
optipng image.png
pngquant (lossy)
pngquant image.png
svgo image.svg -o image.min.svg

See here: https://imagemagick.org/script/command-line-options.php#format_identify_

and here: https://imagemagick.org/script/escape.php