identify — Inspect Image Metadata and Format

Practical guide to ImageMagick's identify — read format, dimensions, colour depth and EXIF metadata from images, ideal for scripts and batch inspection.

identify from the ImageMagick toolkit inspects image files without ever changing them: format, dimensions, colour depth, colourspace, compression and the full set of EXIF metadata come back in a single call. With -format you trim the output to exactly what you need – perfect for scripts, CSV reports or quickly inspecting whole directories of images. On ImageMagick 7 the preferred invocation is magick identify, but the classic identify command remains compatible.

Basic Usage

identify <image> — Show basic image info (format, dimensions, color depth, size).

identify photo.jpg

identify -verbose <image> — Show all available image properties and metadata.

identify -verbose photo.jpg

identify <image1> <image2> ... — Identify multiple images at once.

identify *.png

identify -ping <image> — Read only basic info without loading the full image (faster).

identify -ping largefile.tiff

Format Output

identify -format "%w x %h" <image> — Print only width and height.

identify -format "%w x %h" photo.jpg

identify -format "%m" <image> — Print only the image format (JPEG, PNG, etc.).

identify -format "%m" photo.jpg

identify -format "%b" <image> — Print the file size in bytes.

identify -format "%b" photo.jpg

identify -format "%z" <image> — Print the bit depth (e.g., 8, 16).

identify -format "%z" photo.jpg

identify -format "%r" <image> — Print the image class and colorspace (e.g. DirectClass sRGB).

identify -format "%r" photo.jpg

identify -format "%C" <image> — Print the compression type.

identify -format "%C" photo.jpg

identify -format "%n" <image> — Print the number of frames/layers (useful for GIFs or multi-page TIFFs).

identify -format "%n" animation.gif

identify -format "%Q" <image> — Print the JPEG compression quality.

identify -format "%Q" photo.jpg

Metadata & Properties

identify -format "%[EXIF:*]" <image> — Print all EXIF metadata.

identify -format "%[EXIF:*]" photo.jpg

identify -format "%[EXIF:DateTimeOriginal]" <image> — Print the original capture date from EXIF.

identify -format "%[EXIF:DateTimeOriginal]" photo.jpg

identify -format "%[EXIF:Make] %[EXIF:Model]" <image> — Print the camera make and model.

identify -format "%[EXIF:Make] %[EXIF:Model]" photo.jpg

identify -format "%[colorspace]" <image> — Print the colorspace property.

identify -format "%[colorspace]" photo.jpg

identify -format "%[channels]" <image> — Print the number and type of channels.

identify -format "%[channels]" photo.png

identify -format "%[type]" <image> — Print the image type (TrueColor, Grayscale, Palette, etc.).

identify -format "%[type]" photo.png

Batch & Scripting

identify -format "%f: %wx%h\n" *.jpg — List all JPEGs with filename and dimensions.

identify -format "%f: %wx%h\n" *.jpg

identify -format "%f,%w,%h,%b,%m\n" *.png — Generate CSV output for all PNGs.

identify -format "%f,%w,%h,%b,%m\n" images/*.png

identify -format "%[fx:w*h]" <image> — Calculate total pixel count using fx expressions.

identify -format "%[fx:w*h]" photo.jpg

identify -format "%[fx:w/h]" <image> — Calculate the aspect ratio.

identify -format "%[fx:w/h]" photo.jpg

Common Format Escapes

%w, %h — Width and height in pixels.

identify -format "%w x %h" photo.jpg

%m, %f, %e — Format (magick), filename, extension.

identify -format "%f (%m)" photo.jpg

%b, %z, %r — File size, bit depth, image class/colorspace.

identify -format "Size: %b, Depth: %z, Color: %r" photo.jpg

%k, %Q, %C — Unique colors, quality, compression type.

identify -format "Colors: %k, Quality: %Q" photo.jpg

%x, %y — Horizontal and vertical resolution (DPI).

identify -format "%x x %y DPI" photo.jpg

Conclusion

identify is a read-only tool and therefore harmless: it never modifies a file, it only reports on it. For everyday work identify <image> plus a well-chosen -format string is usually all you need; -ping speeds up inspection of large files because only the header is read. Keep in mind that %[EXIF:*] can expose personal data such as GPS coordinates, camera serial numbers or timestamps – worth a look before you publish any image. On ImageMagick 7, magick identify is the recommended invocation.

Further Reading

  • convert – convert, resize and transform images
  • compare – compare two images pixel by pixel
  • mogrify – batch-edit images in place