View Image File Metadata From the Command Line

By | December 6, 2008

Did you know you can access all the information store in a JPG/PNG/GIF file from the command line? Install the ImageMagick package and do this:

identify -verbose image_file.jpg

The output will be something llike this:

Image: image_file.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 640×480+0+0
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 115.959 (0.45474)
      Standard deviation: 76.5409 (0.30016)
      Min: 0 (0)
      Max: 255 (1)
      Mean: 114.635 (0.449548)
      Standard deviation: 81.5852 (0.319942)
      Min: 0 (0)
      Max: 255 (1)
      Mean: 116.819 (0.458114)
      Standard deviation: 84.7587 (0.332387)
  Rendering intent: Undefined
  Units: PixelsPerInch
  Filesize: 62.5703kb
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 640×480+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 90
  Orientation: Undefined
  Jpeg:colorspace: 2
  Jpeg:sampling-factor: 2×1,1×1,1×1
  Signature: 59dddedfad604ea3f369256c41ed3f42bf6150cf960d62409cfc8c6103b65e18
  Tainted: False
  Version: ImageMagick 6.3.7 08/21/08 Q16

You can use this to extract specific fields from image files and make scripts that sort your images according to quality, background color or image size.
Original tip here.

4 thoughts on “View Image File Metadata From the Command Line

  1. Pingback: View Image File Metadata From the Command Line | Linux-Trickz

  2. owen

    You can also use jhead, and file to extract some more simple information although some of it may be repeated.


Leave a Reply

Your email address will not be published. Required fields are marked *