Themagick 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. SeeCommand Line Processing for advice on how to structure yourmagick identify command or see below for example usages of the command.
Example Usage
We list a few examples of themagick identify command here to illustrate its usefulness and ease of use. To get started, lets identify an image in the JPEG format:
$ magick identify rose.jpgrose.jpg JPEG 70x46 70x46+0+0 8-bit sRGB 2.36KB 0.000u 0:00.000
By default,magick 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:
$ magick identify -verbose rose.jpgImage: rose.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Mime type: image/jpeg Class: DirectClass Geometry: 70x46+0+0 Units: Undefined Type: TrueColor Endianness: Undefined Colorspace: sRGB Depth: 8-bit Channel depth: Red: 8-bit Green: 8-bit Blue: 8-bit Channel statistics: Pixels: 3220 Red: min: 31 (0.121569) max: 255 (1) mean: 145.557 (0.570814) standard deviation: 69.1933 (0.271346) kurtosis: -1.38945 skewness: 0.138955 entropy: 0.970683 Green: min: 27 (0.105882) max: 255 (1) mean: 89.246 (0.349984) standard deviation: 52.4608 (0.205729) kurtosis: 2.60139 skewness: 1.80708 entropy: 0.869711 Blue: min: 21 (0.0823529) max: 255 (1) mean: 80.4196 (0.315371) standard deviation: 54.9377 (0.215442) kurtosis: 2.93417 skewness: 1.95544 entropy: 0.853176 Image statistics: Overall: min: 21 (0.0823529) max: 255 (1) mean: 105.074 (0.412056) standard deviation: 58.8639 (0.230839) kurtosis: 1.37788 skewness: 1.48073 entropy: 0.897856 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) Alpha color: grey74 Background color: white Border color: srgb(223,223,223) Transparent color: none Interlace: None Intensity: Undefined Compose: Over Page geometry: 70x46+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 92 Orientation: Undefined Properties: jpeg:colorspace: 2 jpeg:sampling-factor: 1x1,1x1,1x1 signature: aea65c9b557d779d142f26d04abe7008bab50f1e9647faae20afdcc6c15140d5 Artifacts: verbose: true Tainted: False Filesize: 2.65KB Number pixels: 3.22K User time: 0.000u Elapsed time: 0:01.000 Version: ImageMagick 7.0.4-8 Q16 x86_64 http://imagemagick.org
Note, the image signature is generated from the pixel components, not the image metadata.
To get the print size in inches of an image at 72 DPI, use:
$ magick identify -format "%[fx:w/72] by %[fx:h/72] inches" document.png8.5 x 11 inches
The depth and dimensions of a raw image must be specified on the command line:
$ magick identify -depth 8 -size 640x480 image.rawimage.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:
$ magick identify -verbose -features 1 -moments -unique image.png
To display the convex hull and minimum bounding box attributes of the image, use:
magick identify -define identify:convex-hull=true image.png
Here is a special define that outputs the location of the minimum or maximum pixel of the image:
magick identify -precision 5 -define identify:locate=maximum -define identify:limit=3 image.png
You can find additional examples of usingmagick identify inExamples of ImageMagick Usage.
Option Summary
Themagick 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 |
| -authenticatevalue | decrypt image with this password |
| -auto-orient | automagically orient image |
| -channeltype | apply option to select image channels |
| -clip | clip along the first path from the 8BIM profile |
| -clip-maskfilename | associate clip mask with the image |
| -clip-pathid | clip along a named path from the 8BIM profile |
| -colorspacetype | set image colorspace |
| -cropgeometry | crop the image |
| -debugevents | display copious debugging information |
| -defineformat:option | define one or more image format options |
| -densitygeometry | horizontal and vertical density of the image |
| -depthvalue | image depth |
| -endiantype | endianness (MSB or LSB) of the image |
| -extractgeometry | extract area from image |
| -featuresdistance | analyze image features (e.g. contract, correlations, etc.). |
| -formatstring | output formatted image characteristics |
| -gammavalue | level of gamma correction |
| -grayscalemethod | convert image to grayscale |
| -help | print program options |
| -interlacetype | type of image interlacing scheme |
| -interpolatemethod | pixel color interpolation method |
| -limittype value | pixel cache resource limit |
| -listtype | Color, Configure, Delegate, Format, Magic, Module, Resource, or Type |
| -logformat | format of debugging information |
| -maskfilename | 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. |
| -precisionvalue | 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-factorgeometry | horizontal and vertical sampling factor |
| -setattribute value | set an image attribute |
| -sizegeometry | width and height of image |
| -strip | strip image of all profiles and comments |
| -unique | display image the number of unique colors in the image. |
| -unitstype | the units of image resolution |
| -verbose | print detailed information about the image |
| -version | print version information |
| -virtual-pixelmethod | access method for pixels outside the boundaries of the image |