LoginSignup
20
11

More than 5 years have passed since last update.

Linux環境で画像ファイルの情報を確認する方法

Last updated at Posted at 2016-09-13

Linuxのコマンドライン環境で作業をする際に、画像ファイルの情報を確認したい場合や簡単な加工をしたい場合があったので、その方法を備忘録として投稿します。

環境

  • Ubuntu 14.04.5 LTS

コマンド

画像ファイルの種類と画素数を確認

$ identify sample_01.jpg 
sample_01.jpg JPEG 3000x1993 3000x1993+0+0 8-bit DirectClass 2.886MB 0.120u 0:00.120

画像ファイルのより詳細な情報を確認

$ identify -verbose sample_01.jpg
Image: sample_01.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 3000x1993+0+0
  Resolution: 350x350
  Print size: 8.57143x5.69429
  ・
  ・
  ・
  Elapsed time: 0:01.179
  Version: ImageMagick 6.7.7-10 2016-06-01 Q16 http://www.imagemagick.org

画像の縦横の長さを720x390にリサイズ

$ convert -geometry 720x390 sample_01.jpg img_01_01.jpg

画像の大きさを60%に縮小

$ convert -geometry "60%" server.jpg server_60.jpg 

(x,y)=(160, 0) を始点から (w,h)=(960,720)で切り出し

$ convert -crop 960x720+160+0  src.png  dest.jpg
20
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
11