識別程序描述一個或多個圖像文件的格式和特徵,還會報告圖像是不完整還是損壞。
返回的信息包括圖像編號,文件名稱,圖像的寬度和高度,圖像是否為彩色圖,圖像中的顏色數,圖像中的字節數,圖像的格式(JPEG,PNG等),最後是讀取和處理圖像所花費的秒數。
而 verbose 選項提供了更多屬性。
有關如何構建識別命令的建議,請參閱命令行處理,或參見下面的命令用法示例。
/usr/local/ImageMagick/bin/magick identify -help
我們在此列出了一些識別命令的範例,以說明其有用性和易用性。
首先,識別 JPEG 格式的圖像:
/usr/local/ImageMagick/bin/magick identify rose.jpg
rose.jpg JPEG 70x46 70x46+0+0 8-bit sRGB 4069B 0.000u 0:00.000
再來,更詳細地查看相同的圖像:
/usr/local/ImageMagick/bin/magick 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
Resolution: 72x72
Print size: 0.972222x0.638889
Units: PixelsPerInch
Colorspace: sRGB
Type: TrueColor
Base type: Undefined
Endianess: Undefined
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Channel statistics:
Pixels: 3220
Red:
min: 37 (0.145098)
max: 255 (1)
mean: 145.579 (0.570899)
standard deviation: 67.3299 (0.264039)
kurtosis: -1.3792
skewness: 0.0975578
entropy: 0.972583
Green:
min: 31 (0.121569)
max: 255 (1)
mean: 89.2466 (0.349987)
standard deviation: 52.0593 (0.204154)
kurtosis: 2.71248
skewness: 1.83046
entropy: 0.875544
Blue:
min: 17 (0.0666667)
max: 255 (1)
mean: 80.4068 (0.315321)
standard deviation: 54.0105 (0.211806)
kurtosis: 3.00057
skewness: 1.95559
entropy: 0.852568
Image statistics:
Overall:
min: 17 (0.0666667)
max: 255 (1)
mean: 105.078 (0.412069)
standard deviation: 57.7999 (0.226666)
kurtosis: -0.250668
skewness: 1.03343
entropy: 0.900232
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte 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: 100
Orientation: Undefined
Properties:
date:create: 2018-11-01T15:09:07+08:00
date:modify: 2018-11-01T15:09:07+08:00
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
signature: ac47438728e9f0fd8773883e18f8aa569dbe624488b67cf668827f27f81be590
Artifacts:
verbose: true
Tainted: False
Filesize: 4069B
Number pixels: 3220
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-10-08 https://imagemagick.org
要獲得 72 DPI 圖像的英寸打印尺寸,使用:
/usr/local/ImageMagick/bin/magick identify -format '%[fx:w/72] by %[fx:h/72] inches' document.png
8.5 x 11 inches
必須在命令行中指定原始圖像的深度和尺寸:
/usr/local/ImageMagick/bin/magick identify -depth 8 -size 640x480 image.raw
image.raw RGB 640x480 sRGB 9kb 0.000u 0:01
顯示圖像紋理特徵,時刻,感知哈希以及圖像中唯一顏色的數量:
/usr/local/ImageMagick/bin/magick identify -verbose -features 1 -moments -unique image.png
這是一個特殊的定義,輸出圖像的最小或最大像素的位置:
/usr/local/ImageMagick/bin/magick identify -precision 5 -define identify:locate=maximum -define identify:limit=3 image.png
可以在 Examples of ImageMagick Usage 中找到使用標識的其他示例。
-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 |
-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 |
-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 |
參考資料:
Command-line Tools: Identify @ ImageMagick
https://www.imagemagick.org/script/identify.php
新增時間 | 2020-02-05 |
最後更新 | 2022-02-09 |