(18) GIF,JPEG,PNG,TIFF画像ファイル情報を表示

投稿者: | 2014年2月8日

6,235 views

この記事は最終更新から 2846日 が経過しています。

ImageMagickの identifyコマンドを使用すると、各種画像ファイルの情報を読み出すことができる。

ImageMagick wiki

例えば BMP形式画像ファイルの情報を読み出してみる。

[user@dog-server]$ identify ./bird.bmp 
./bird.bmp BMP 212x156 212x156+0+0 8-bit DirectClass 96.9kb

format指定により、任意のパラメーターのみを表示できる。
例えば、wは画像の幅、hは画像の高さを表示する。

[user@dog-server]$ identify -format "%w %h" ./bird.bmp 
212 156

他の画像形式ファイルについても試してみる。

[user@dog-server]$ identify bird.gif 
bird.gif GIF 212x156 212x156+0+0 8-bit PseudoClass 256c 26.8kb 
[user@dog-server]$ identify bird.jpg 
bird.jpg JPEG 212x156 212x156+0+0 8-bit DirectClass 40.6kb 
[user@dog-server]$ identify bird.png 
bird.png PNG 212x156 212x156+0+0 8-bit DirectClass 82.8kb 
[user@dog-server]$ identify bird.tif 
bird.tif TIFF 212x156 212x156+0+0 8-bit DirectClass 104kb

ImageMagick 6.8.9-7を以下のようにインストールした。

$ ./configure --prefix=/usr/local --with-quantum-depth=16
$ make -j
$ make check
$ sudo make install

関係ないが GrafficsMagick 1.3.20を以下のようにインストールした。

$ ./configure --prefix=/usr/local --with-quantum-depth=16 --enable-shared=yes
$ make -j
$ make check
$ sudo make install

アクセス数(直近5日): ※試験運用中、BOT除外簡易実装済
  • 2025-06-15: 1回
  • 2025-06-14: 0回
  • 2025-06-13: 2回
  • 2025-06-12: 1回
  • 2025-06-11: 2回
  • コメントを残す

    メールアドレスが公開されることはありません。 が付いている欄は必須項目です