Simple editing using ImageMagick

Tags:  Linux Terminal Cheat Sheets

Resize an image

Resize the image using percentage.

convert image.png -resize 60% resized.png

Or define the dimension explicitly.

convert image.png -resize 640x360 resized.png

Flip an image

Mirror an image left and right.

convert image.png -flop image_mirrored.png

Or flip an image upside down.

convert image.png -flip image_upside_down.png

Crop an image

Crop image from top or bottom, where 60 is the number of pixels.

convert image.png -gravity North -chop 0x60 cropped.png
convert image.png -gravity South -chop 0x60 cropped.png

Or crop image from left or right.

convert image.png -gravity East -chop 60x0 cropped.png
convert image.png -gravity West -chop 60x0 cropped.png

Crop from centre of the image.

convert image.png -gravity center -crop 640x360+0+0 cropped.png

Or crop the image with offset from the top left corner, with the first number after the dimension being the horizontal offset, and the second number being the vertical offset.

convert image.png -crop 640x360+390+248 cropped.png

Put 2 images side by side.

convert left.png right.png +append combined.png

Create a 4 images gallery.

convert \( top_left.png top_right.png +append \) \( bottom_left.png bottom_right.png +append \) -append combined.png

Remove metadata

Remove the metadata in place.

mogrify -strip image.png

Check metadata

Check for Properties from the output of the following command.

identify -verbose image.png