Color Modes

Command-line Tools: Identify

Image Format and Characteristics

Example UsageOption Summary

The identify program describes the format and characteristics of one or more image files. It also reports if an image is incomplete or corrupt. The information returned includes the image number, the file name, the width and height of the image, whether the image is colormapped or not, the number of colors in the image, the number of bytes in the image, the format of the image (JPEG, PNM, etc.), and finally the number of seconds it took to read and process the image. Many more attributes are available with the verbose option. See Command Line Processing for advice on how to structure your identify command or see below for example usages of the command.

Example Usage

We list a few examples of the identify command here to illustrate its usefulness and ease of use. To get started, lets identify an image in the JPEG format:

-> identify rose.jpg
rose.jpg JPEG 70x46 70x46+0+0 8-bit sRGB 2.36KB 0.000u 0:00.000

By default, identify provides the following output:

    Filename[frame #] image-format widthxheight page-widthxpage-height+x-offset+y-offset colorspace user-time elapsed-time

Next, we look at the same image in greater detail:

-> identify -verbose rose.jpg
Image: rose.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 70x46+0+0
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 3220
    Red:
      min: 35 (0.137255)
      max: 255 (1)
      mean: 145.57 (0.570865)
      standard deviation: 67.2976 (0.263912)
      kurtosis: -1.37971
      skewness: 0.0942169
      entropy: 0.974889
    Green:
      min: 33 (0.129412)
      max: 255 (1)
      mean: 89.2193 (0.349879)
      standard deviation: 52.0803 (0.204236)
      kurtosis: 2.70722
      skewness: 1.82562
      entropy: 0.877139
    Blue:
      min: 11 (0.0431373)
      max: 255 (1)
      mean: 80.3742 (0.315193)
      standard deviation: 53.8536 (0.21119)
      kurtosis: 2.90978
      skewness: 1.92617
      entropy: 0.866692
  Image statistics:
    Overall:
      min: 11 (0.0431373)
      max: 255 (1)
      mean: 105.055 (0.411979)
      standard deviation: 58.1422 (0.228008)
      kurtosis: 1.25759
      skewness: 1.4277
      entropy: 0.90624
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33,0.03)
    green primary: (0.3,0.6,0.1)
    blue primary: (0.15,0.06,0.79)
    white point: (0.3127,0.329,0.3583)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 70x46+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 92
  Orientation: Undefined
  Properties:
    date:create: 2014-11-09T09:00:35-05:00
    date:modify: 2014-11-09T09:00:35-05:00
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 22a99838bd5594250f706d1d9383b2830f439fcbaf1455cbe2f7f59a4deb065a
  Artifacts:
    filename: rose.jpg
    verbose: true
  Tainted: False
  Filesize: 2.36KB
  Number pixels: 3.22K
  Pixels per second: 3.22EB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick Q16 https://imagemagick.org

Note, the image signature is generated from the pixel components, not the ima ge metadata.

To get the print size in inches of an image at 72 DPI, use:

-> identify -format "%[fx:w/72] by %[fx:h/72] inches" document.png
8.5 x 11 inches

The depth and dimensions of a raw image must be specified on the command line:

-> identify -depth 8 -size 640x480 image.raw
image.raw RGB 640x480 sRGB 9kb 0.000u 0:01

Here we display the image texture features, moments, perceptual hash, and the number of unique colors in the image:

-> identify -verbose -features 1 -moments -unique image.png

Here is a special define that outputs the location of the minimum or maximum pixel of the image:

identify -precision 5 -define identify:locate=maximum -define identify:limit=3 image.png

You can find additional examples of using identify in Examples of ImageMagick Usage.

Option Summary

The identify command recognizes these options. Click on an option to get more details about how that option works.

Option Description
-alpha on, activate, off, deactivate, set, opaque, copy", transparent, extract, background, or shape the alpha channel
-antialias remove pixel-aliasing
-authenticate value decrypt image with this password
-auto-orient automagically orient image
-channel type apply option to select image channels
-clip clip along the first path from the 8BIM profile
-clip-mask filename associate clip mask with the image
-clip-path id clip along a named path from the 8BIM profile
-colorspace type set image colorspace
-crop geometry crop the image
-debug events display copious debugging information
-define format:option define one or more image format options
-density geometry horizontal and vertical density of the image
-depth value image depth
-endian type endianness (MSB or LSB) of the image
-extract geometry extract area from image
-features distance analyze image features (e.g. contract, correlations, etc.).
-format string output formatted image characteristics
-gamma value level of gamma correction
-grayscale method convert image to grayscale
-help print program options
-interlace type type of image interlacing scheme
-interpolate method pixel color interpolation method
-limit type value pixel cache resource limit
-list type Color, Configure, Delegate, Format, Magic, Module, Resource, or Type
-log format format of debugging information
-mask filename associate a mask with the image
-moments display image moments and perceptual hash.
-monitor monitor progress
-negate replace each pixel with its complementary color
-ping by default, efficiently determine certain image characteristics by only reading the requisite image metadata. To accurately identify all the image metadata and pixel characteristics, use +ping.
-precision value set the maximum number of significant digits to be printed
-quiet suppress all warning messages
-regard-warnings pay attention to warning messages.
-respect-parentheses settings remain in effect until parenthesis boundary.
-sampling-factor geometry horizontal and vertical sampling factor
-set attribute value set an image attribute
-size geometry width and height of image
-strip strip image of all profiles and comments
-unique display image the number of unique colors in the image.
-units type the units of image resolution
-verbose print detailed information about the image
-version print version information
-virtual-pixel method access method for pixels outside the boundaries of the image