Monday, October 19, 2015

Quickly generate a spreadsheet of image properties from a large number of images

Recently there was a need to find out some image properties e.g. the pixel width and height of a large number of photo images. In Windows Explorer, you could enable the Dimensions property to be displayed in the detail view, but you could not do too much with it. You could not do additional calculations on top of the view.

Fortunately, ImageMagick has an identify command to print out information about one or more images. The following shows how to use identify to print out the image file names and dimensions.


  1. Open up a Command Prompt.
  2. At the prompt, type in the command e.g.

    C:\> identify -ping -format "%i,%w,%h\n" *.jpg

    Note: the ping option will prevent the loading of the entire file.
    The format string has place holders for the properties to be printed.
    %i is for the image filename
    %w is for the image width
    %h is for the image height
    And optionally some delimters such as commas between the properties and terminated with a new line character
    '\n'.
    For more information about the string format placeholders, visit http://www.imagemagick.org/script/escape.php
  3. Press RETURN to run the command.

    The information is printed to the screen.

  4. If you want to print the information to a file, type in the following command.

    C:\> identify -ping -format "%i,%w,%h\n" > output.csv
  5. The resultant file can be displayed and further manipulated in a spreadsheet as shown below.



No comments:

Related Posts with Thumbnails