magick identify 程序會描述一個或多個影像檔的格式和特性。它還會報告影像是否不完整或損毀。返回的資訊包括影像編號、檔案名稱、影像的寬度和高度、影像是否具有顏色映射、影像中的顏色數量、影像中的位元組數、影像的格式(JPEG、PNM 等),以及最後讀取和處理影像所花費的秒數。使用詳細選項可以使用更多屬性。有關如何建構 magick identify 命令的建議,請參閱命令列處理,或參閱下方以取得命令的使用範例。
範例用法
我們在此列出 magick identify 命令的一些範例,以說明其用途和易用性。首先,讓我們識別 JPEG 格式的影像
$ magick identify rose.jpg rose.jpg JPEG 70x46 70x46+0+0 8-bit sRGB 2.36KB 0.000u 0:00.000
根據預設,magick identify 會提供以下輸出
- 檔案名稱[影格 #] 影像格式 寬x高 頁面寬x頁面高+x-偏移+y-偏移 色彩空間 使用者時間 經過時間
接下來,我們更詳細地查看同一個影像
$ 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 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 https://imagemagick.dev.org.tw
請注意,影像簽章是由像素元件產生的,而不是影像中繼資料。
若要以 72 DPI 取得影像的列印尺寸(以英寸為單位),請使用
$ magick identify -format "%[fx:w/72] by %[fx:h/72] inches" document.png 8.5 x 11 inches
必須在命令列上指定原始影像的深度和尺寸
$ magick identify -depth 8 -size 640x480 image.raw image.raw RGB 640x480 sRGB 9kb 0.000u 0:01
在這裡,我們顯示影像紋理特徵、矩、感知雜湊和影像中唯一顏色的數量
$ magick identify -verbose -features 1 -moments -unique image.png
若要顯示影像的凸包和最小邊界框屬性,請使用
magick identify -define identify:convex-hull=true image.png
這是一個特殊的定義,用於輸出影像中最小或最大像素的位置
magick identify -precision 5 -define identify:locate=maximum -define identify:limit=3 image.png
您可以在ImageMagick 使用範例中找到使用 magick identify 的其他範例。
選項摘要
magick identify 命令會辨識這些選項。按一下選項以取得有關該選項運作方式的更多詳細資訊。
選項 | 說明 |
---|---|
-alpha | 開啟、啟動、關閉、停用、設定、不透明、複製"、透明、提取、背景或形狀 Alpha 色板 |
-antialias | 移除像素鋸齒 |
-authenticate 值 | 使用此密碼解密影像 |
-auto-orient | 自動調整影像方向 |
-channel 類型 | 將選項套用至選取的影像通道 |
-clip | 沿著 8BIM 設定檔中的第一條路徑裁剪 |
-clip-mask 檔案名稱 | 將裁剪遮罩與影像關聯 |
-clip-path ID | 沿著 8BIM 設定檔中的指定路徑裁剪 |
-colorspace 類型 | 設定影像色彩空間 |
-crop 幾何 | 裁剪影像 |
-debug 事件 | 顯示大量除錯資訊 |
-define 格式:選項 | 定義一個或多個影像格式選項 |
-density 幾何 | 影像的水平和垂直密度 |
-depth 值 | 影像深度 |
-endian 類型 | 影像的位元組順序(MSB 或 LSB) |
-extract 幾何 | 從影像中提取區域 |
-features 距離 | 分析影像特徵(例如,合約、相關性等)。 |
-format 字串 | 輸出格式化的影像特性 |
-gamma 值 | 伽瑪校正級別 |
-grayscale 方法 | 將影像轉換為灰階 |
-help | 列印程序選項 |
-interlace 類型 | 影像交錯類型的方案 |
-interpolate 方法 | 像素顏色插值方法 |
-limit 類型 值 | 像素快取資源限制 |
-list 類型 | 顏色、組態、委派、格式、魔術、模組、資源或類型 |
-log <var>格式</var> | 除錯資訊的格式 |
-mask <var>檔案名稱</var> | 將遮罩與影像關聯 |
-moments | 顯示影像矩和感知雜湊。 |
-monitor | 監控進度 |
-negate | 將每個像素替換為其互補色 |
-ping | 預設情況下,僅透過讀取必要的影像中繼資料即可有效地確定某些影像特性。若要準確識別所有影像中繼資料和像素特性,請使用 <samp>+ping</samp>。 |
-precision <var>值</var> | 設定要列印的有效位數上限 |
-quiet | 隱藏所有警告訊息 |
-regard-warnings | 注意警告訊息。 |
-respect-parentheses | 設定值會一直生效,直到括號邊界。 |
-sampling-factor <var>幾何</var> | 水平和垂直取樣因子 |
-set <var>屬性 值</var> | 設定影像屬性 |
-size <var>幾何</var> | 影像的寬度和高度 |
-strip | 去除影像的所有描述檔和註解 |
-unique | 顯示影像中唯一顏色的數量。 |
-units <var>類型</var> | 影像解析度的單位 |
-verbose | 列印有關影像的詳細資訊 |
-version | 列印版本資訊 |
-virtual-pixel <var>方法</var> | 影像邊界外像素的存取方法 |