Back to Imagemagick

ImageMagick

www/identify.html

7.1.2-218.5 KB
Original Source

Example UsageOption Summary

The magick 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 magick identify command or see below for example usages of the command.

Example Usage

We list a few examples of the magick 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.jpg rose.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.jpg Image: rose.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Mime type: images/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.png 8.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.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:

$ 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 using magick identify in Examples of ImageMagick Usage.

Option Summary

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

OptionDescription
-alphaon, activate, off, deactivate, set, opaque, copy", transparent, extract, background, or shape the alpha channel
-antialiasremove pixel-aliasing
-authenticate valuedecrypt image with this password
-auto-orientautomagically orient image
-channel typeapply option to select image channels
-clipclip along the first path from the 8BIM profile
-clip-mask filenameassociate clip mask with the image
-clip-path idclip along a named path from the 8BIM profile
-colorspace typeset image colorspace
-crop geometrycrop the image
-debug eventsdisplay copious debugging information
-define format:optiondefine one or more image format options
-density geometryhorizontal and vertical density of the image
-depth valueimage depth
-endian typeendianness (MSB or LSB) of the image
-extract geometryextract area from image
-features distanceanalyze image features (e.g. contract, correlations, etc.).
-format stringoutput formatted image characteristics
-gamma valuelevel of gamma correction
-grayscale methodconvert image to grayscale
-helpprint program options
-interlace typetype of image interlacing scheme
-interpolate methodpixel color interpolation method
-limit type valuepixel cache resource limit
-list typeColor, Configure, Delegate, Format, Magic, Module, Resource, or Type
-log formatformat of debugging information
-mask filenameassociate a mask with the image
-momentsdisplay image moments and perceptual hash.
-monitormonitor progress
-negatereplace each pixel with its complementary color
-pingby 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 valueset the maximum number of significant digits to be printed
-quietsuppress all warning messages
-regard-warningspay attention to warning messages.
-respect-parenthesessettings remain in effect until parenthesis boundary.
-sampling-factor geometryhorizontal and vertical sampling factor
-set attribute valueset an image attribute
-size geometrywidth and height of image
-stripstrip image of all profiles and comments
-uniquedisplay image the number of unique colors in the image.
-units typethe units of image resolution
-verboseprint detailed information about the image
-versionprint version information
-virtual-pixel methodaccess method for pixels outside the boundaries of the image