Home Command line utilities How To View Image Metadata On Linux
View Image Metadata On Linux

How To View Image Metadata On Linux

By sk
9272 Views

Image Metadata is a set of information about the images. Metadata is either embedded into the image itself or stored in a separate file. There are three types of Metadata, namely;

  • Technical metadata,
  • Descriptive metadata,
  • Administrative metadata.

As the name says, the Technical metadata usually includes technical information of an image, such as camera details, DPI, shutter speed, file size, image format, the date and time when the image is captured or created, the software used to create the image and a few other details. The technical metadata is mostly generated automatically by the camera devices.

The Descriptive metadata is manually added by the photographer. The owner (or photographer) can add it manually by using any external software such as GIMP or Photoshop. It includes the information such as the title of the photo, location, photographer name and comments etc. The descriptive metadata is very useful to search photos easily and quickly.

The Administrative metadata contains identification and contact details of the owner, license, copyright and usage terms of the images.

Adding metadata to images is important to prevent content theft, misuse and track the usage of images. However, the metadata can be easily striped away. Hope you get the basic idea about Image metadata and its types.

Now let us go ahead and see how to find the information about images from command line on Linux.

View Image Metadata On Linux

There are many tools to find the metadata of an image on Linux. Here, I have given three command line tools to view such details.

1. Using ImageMagick

ImageMagick has a command line tool named "Identify" to find image metadata. ImageMagick is available in the default repositories of most Linux distributions.

On Arch Linux and its variants, run the following command to install ImageMagick:

$ sudo pacman -S imagemagick

On Debian, Ubuntu, Linux Mint:

$ sudo apt install imagemagick

On Fedora:

$ sudo dnf install imagemagick

On SUSE/openSUSE:

$ sudo zypper install ImageMagick

Now let us find Image metadata. To do so, simply run:

$ identify -verbose image.png

This command will list detailed output of the metadata of the given image.

Image: image.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 1366x768+0+0
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 1049088
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 158.62 (0.62204)
      standard deviation: 36.8176 (0.144383)
      kurtosis: -0.256842
      skewness: -0.00384146
      entropy: 0.897097
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 39.1664 (0.153594)
      standard deviation: 30.5192 (0.119683)
      kurtosis: 26.7374
      skewness: 4.16992
      entropy: 0.773393
    Blue:
      min: 0 (0)
      max: 255 (1)
      mean: 48.4269 (0.189909)
      standard deviation: 27.7343 (0.108762)
      kurtosis: 33.5882
      skewness: 4.85108
      entropy: 0.741411
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 82.0712 (0.321848)
      standard deviation: 31.9173 (0.125166)
      kurtosis: 35.6513
      skewness: 6.83895
      entropy: 0.803967
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 1366x768+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2019-08-26T19:25:54+06:00
    date:modify: 2019-08-09T13:49:32+05:00
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 2
    png:IHDR.color_type: 2 (Truecolor)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 1366, 768
    png:sRGB: intent=0 (Perceptual Intent)
    signature: 6e35d79e6896e49e6256eadeec46b4f6a4951b13e309a9c89d9235ce51a3b541
  Artifacts:
    filename: image.png
    verbose: true
  Tainted: False
  Filesize: 379KB
  Number pixels: 1.049M
  Pixels per second: 26.23MB
  User time: 0.040u
  Elapsed time: 0:01.039
  Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org

If you only want the basic details, such as simply remove -verbose option.

$ identify image.png 
image.png PNG 1366x768 1366x768+0+0 8-bit sRGB 379KB 0.000u 0:00.000

More details can be found in the man pages:

$ man identify

2. Using file command

We can use file command, which is used to determine file types, to view metadata of an image.

$ file image.png 
image.png: PNG image data, 1366 x 768, 8-bit/color RGB, non-interlaced

The file command doesn't have an option to provide detailed output like "identify" command. It only prints the basic metadata.

Read man pages to know more about file command:

$ man file

3. Using Exif Tool

Exif is a command line utility to display and change EXIF data of an image. For those wondering, EXIF (stands for Exchangeable Image File Format) is typically a JPEG file written in your storage device whenever you take a photo.with your smartphone or camera. EXIF data includes details such as date and time of photos, camera settings, geolocation, license and copyright information etc. It is available in the default repositories in Debian and its derivatives like Ubuntu.

$ sudo apt install exif

To view Image metadata using exif, simply run:

$ exif image.jpg

Exif will produce a nice output in tabular column format like below.

EXIF tags in 'image.jpg' ('Motorola' byte order):
--------------------+----------------------------------------------------------
Tag                 |Value
--------------------+----------------------------------------------------------
Image Description   |Lady Evelyn Falls/Chutes Lady Evelyn, Northwest Territorie
Artist              |J. A. Kraulis
Copyright           |J. A. Kraulis/Masterfile (Photographer) - [None] (Editor)
XP Title            |Lady Evelyn Falls/Chutes Lady Evelyn, Northwest Territorie
XP Author           |J. A. Kraulis
Padding             |2060 bytes undefined data
X-Resolution        |72
Y-Resolution        |72
Resolution Unit     |Inch
Padding             |2060 bytes undefined data
Exif Version        |Exif Version 2.1
FlashPixVersion     |FlashPix Version 1.0
Color Space         |Internal error (unknown value 65535)
--------------------+----------------------------------------------------------

Exif not only reads the metadata but also writes EXIF to the images. For more details, check man pages:

$ man exif

Suggested read:


Hope this helps.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

Esc August 27, 2019 - 7:36 pm

For Opensuse 15.1
sudo zypper install ImageMagick

Reply
sk August 27, 2019 - 7:41 pm

Thanks. Corrected now.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More