Imagemagick

Here are some useful imagemagick commands for my own reference. I hope you may find them helpful.

ImageMagick is the best command-line tool for image manipulation I’m aware of. Note that although you install imagemagick, you run a variety of other commands that are common words - not imagemagick with command-line flags to specify behavior.

Identify (see image info):

identify filename.jpg

Output:

image.jpg JPEG 1242x1338 1242x1338+0+0 8-bit sRGB 92364B 0.000u 0:00.000
identify -verbose filename.jpg

Output: Dozens of lines of detailed output including image time, color info, and other properties.

Resize:

convert input.jpg -resize 600x800 out.jpg
convert input.jpg -resize 50% out.jpg

This will keep the same aspect ratio, so it may ignore the exact pixel size. To force the pixel size, add ! to the size:

Instead of 800x600, use 800x600!.

Take a screenshot:

import -display :0 -window root screenshot.png

The display may have to be changed to :1 depending on your window manager.

Resize and strip EXIF data:

convert original.jpg -strip -resize 1024x768 out.jpg

View EXIF data:

identify -format '%[EXIF:*]' filename.jpg

Resize all images to same size (manually make them the same ratio first):

mogrify -resize 640x480 *.jpg

Create gif (order listed determines ordering in gif). Better gif tutorial here.

convert -delay 20 -loop 0 file1.jpg file2.jpg file3.jpg output.gif