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.
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 640x480 DirectClass 87kb 0.050u 0:01
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) Class: DirectClass Geometry: 70x46+0+0 Resolution: 72x72 Print size: 0.972222x0.638889 Units: PixelsPerInch Type: TrueColor Endianess: Undefined Colorspace: RGB Depth: 8-bit Channel depth: red: 8-bit green: 8-bit blue: 8-bit Channel statistics: red: min: 37 (0.145098) max: 255 (1) mean: 145.58 (0.5709) standard deviation: 67.3195 (0.263998) green: min: 31 (0.121569) max: 255 (1) mean: 89.2512 (0.350005) standard deviation: 52.0488 (0.204113) blue: min: 17 (0.0666667) max: 255 (1) mean: 80.4075 (0.315323) standard deviation: 54.0052 (0.211785) Rendering intent: Undefined Interlace: None Background color: white Border color: rgb(223,223,223) Matte color: grey74 Transparent color: black Page geometry: 70x46+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 100 Orientation: Undefined Properties: create-date: 2008-01-08T11:08:52-05:00 jpeg:colorspace: 2 jpeg:sampling-factor: 2x2,1x1,1x1 modify-date: 2005-04-07T12:48:13-04:00 signature: dcd00d6303f80f4fa53f991804cb026151c1e851b7a96255e82da87299583ebc Artifacts: verbose: true Tainted: False Filesize: 3.97266kb Number pixels: 3.14453kb Version: ImageMagick 6.4.9 2009-01-01 Q16 http://www.imagemagick.org
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 DirectClass 9kb 0.000u 0:01
Here we display the number of unique colors in the image:
identify -define unique=true -verbose image.png
You can find additional examples of using identify in Examples of ImageMagick Usage.
The identify command recognizes these options. Click on an option to get more details about how that option works.
Option | Description |
---|---|
-alpha | activate, deactivate, reset, or set the alpha channel |
-antialias | remove pixel-aliasing |
-authenticate value | decrypt image with this password |
-channel type | apply option to select image channels |
-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 |
-extract geometry | extract area from image |
-format string | output formatted image characteristics |
-gamma value | level of gamma correction |
-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 |
-monitor | monitor progress |
-quiet | suppress all warning messages |
-regard-warnings | pay attention to warning messages. |
-respect-parenthesis | 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 |
-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 |
To return the number of unique colors in your image, add -define identify:unique=true to your command-line