# 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.

Source: https://www.jpkc.com/db/en/cheatsheets/images-media/identify/

<!-- PROSE:intro -->
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.
<!-- PROSE:intro:end -->

## Basic Usage

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

```bash
identify photo.jpg
```

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

```bash
identify -verbose photo.jpg
```

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

```bash
identify *.png
```

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

```bash
identify -ping largefile.tiff
```

## Format Output

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

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

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

```bash
identify -format "%m" photo.jpg
```

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

```bash
identify -format "%b" photo.jpg
```

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

```bash
identify -format "%z" photo.jpg
```

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

```bash
identify -format "%r" photo.jpg
```

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

```bash
identify -format "%C" photo.jpg
```

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

```bash
identify -format "%n" animation.gif
```

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

```bash
identify -format "%Q" photo.jpg
```

## Metadata & Properties

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

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

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

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

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

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

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

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

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

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

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

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

## Batch & Scripting

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

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

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

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

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

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

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

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

## Common Format Escapes

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

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

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

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

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

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

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

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

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

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

<!-- PROSE:outro -->
## 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

- [ImageMagick: identify](https://imagemagick.org/script/identify.php) – official reference for the command and its options
- [ImageMagick: Format and Print Image Properties](https://imagemagick.org/script/escape.php) – the complete list of all `-format` escapes
<!-- PROSE:outro:end -->

## Related Commands

- [convert](https://www.jpkc.com/db/en/cheatsheets/images-media/convert/) – convert, resize and transform images
- [compare](https://www.jpkc.com/db/en/cheatsheets/images-media/compare/) – compare two images pixel by pixel
- [mogrify](https://www.jpkc.com/db/en/cheatsheets/images-media/mogrify/) – batch-edit images in place

