言語
サーバ関連
ツール
API
読み物
その他
[AD]
ImageMagickをインストールすると自動でついてくるidentifyコマンドを用いれば、画像の保存形式やサイズなどを簡単に取得することが出来る。
identifyにファイル名を渡してやると画像形式、解像度などシンプルな情報を取得できる。
$ identify hoge.jpg hoge.jpg JPEG 303x431 303x431+0+0 DirectClass 8-bit 145.752kb
-verboseオプションをつけるとかなり詳細な情報が取得できる。
$ identify -verbose hoge.jpg Image: hoge.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Class: DirectClass Geometry: 303x431+0+0 Type: ColorSeparation Endianess: Undefined Colorspace: CMYK Depth: 8-bit Channel depth: Cyan: 8-bit Magenta: 8-bit Yellow: 8-bit Black: 8-bit Channel statistics: Cyan: Min: 0 (0) Max: 255 (1) Mean: 111.969 (0.439093) Standard deviation: 75.4756 (0.295983) Magenta: Min: 0 (0) Max: 255 (1) Mean: 116.246 (0.455867) Standard deviation: 50.2108 (0.196905) Yellow: Min: 0 (0) Max: 255 (1) Mean: 143.773 (0.563817) Standard deviation: 69.3664 (0.272025) Black: Min: 0 (0) Max: 255 (1) Mean: 67.2185 (0.263602) Standard deviation: 85.1329 (0.333854) Total ink density: 363% Rendering intent: Undefined Resolution: 350x350 Units: undefined Filesize: 145.752kb Interlace: None Background color: white Border color: cmyk(223,223,223,0) Matte color: grey74 Transparent color: black Page geometry: 303x431+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 99 Orientation: TopLeft Exif:ColorSpace: 65535 Exif:Compression: 6 Exif:DateTime: 2007:03:26 21:05:58 Exif:ExifImageLength: 431 Exif:ExifImageWidth: 303 Exif:ExifOffset: 164 Exif:JPEGInterchangeFormat: 302 Exif:JPEGInterchangeFormatLength: 7335 Exif:Orientation: 1 Exif:ResolutionUnit: 2 Exif:Software: Adobe Photoshop CS2 Windows Exif:XResolution: 3500000/10000 Exif:YResolution: 3500000/10000 Jpeg:colorspace: 4 Jpeg:sampling-factor: 1x1,1x1,1x1,1x1 Rdf:about: Signature: 73f86ebc098f1c4708e4cda5bd95bc55fceb919b25fb6394744433518fc99101 Xmlns:exif: http://ns.adobe.com/exif/1.0/ Profile-8bim: 9062 bytes Profile-exif: 7643 bytes Profile-xmp: 14996 bytes Tainted: False Version: ImageMagick 6.3.6 10/19/07 Q16 http://www.imagemagick.org
複数ファイルの指定もできます。
$ identify hoge.jpg huga.jpg hoge.jpg JPEG 303x431 303x431+0+0 DirectClass 8-bit 145.752kb huga.jpg[1] JPEG 210x298 210x298+0+0 DirectClass 8-bit 16.1895kb
failed to fetch data: unkown error
failed to fetch data: unkown error