Command Line to return image properties

How can I get the properties of an Image file in windows using the command line?

You can do this using PowerShell.

Commonly filled out metadata for image files contains the camera, the F-stop, resolution, and other useful information about the photo. This can be extremely useful for anyone who takes photos. The image metadata is easily found from the File tab for the photo by clicking Properties, then Details.

...

To use Windows PowerShell to examine this type of metadata means using the Shell.Application COM object, connecting to a file, and then walking through the metadata property bag. This technique is a bit cumbersome. Luckily, I can use the same function I wrote yesterday to accomplish this task.

Note the complete Get File Metadata function is available on the Script Center Repository.

...

Make sure to store results

Because it is possible that the script needs to iterate through thousands of photos, and for each photo it needs to search several hundred metadata attributes, the script will take some time to run. The best thing to do is to store the results in a variable. This will allow sorting and post collection processing of the data following the run.

The Get-FileMetaDataReturnObject.ps1 script contains a single function. The function is the Get-FileMetadata function. I load the function in the Windows PowerShell ISE, and run it to copy the function into memory. After I have done that, I call the function and pass it an array of folder paths. I get the array of folder paths by using the Get-ChildItem cmdlet. Here is the command that performs a recursive lookup of a folder named pics and pulls out the directory paths in that folder. This is a single line command that has wrapped.

$picMetadata = Get-FileMetaData -folder (Get-childitem E:\pics -Recurse -Directory).FullName

...

Write it to a file

Now that I know that the command produces the output I desire, I pipe the results to the Export-CSV cmdlet as shown here (this is a single-line command):

$picMetadata | 
Select 'camera model', dimensions, f-stop, 'flash mode', 'iso speed', 'exposure time', 'focal length', size, path |
Export-CSV -Path c:\fso\photoMetadata.csv -NoTypeInformation

Source Use PowerShell to Find Metadata from Photograph Files

Read the above source link to see what other metadata is avaialable.


There are a lot of tools for the cmd line which can get/extract image metadata.

  1. IrfanView
  2. Exiftool
  3. nconvert

> "C\Program Files\IrfanView\i_view64.exe" *.jpg /info=Jpeg_Info.txt /fullinfo

Sample output (just 1 picture):

>type Jpeg_Info.txt
[Scan-100210-0002.jpg]
File name = Scan-100210-0002.jpg
Directory =
Compression = JPEG, quality: 90, subsampling ON (2x2)
Resolution = 300 x 300 DPI
Image dimensions = 2206 x 3264  Pixels (7.20 MPixels) (1.48)
Print size = 18.7 x 27.6 cm; 7.35 x 10.88 inches
Color depth = 16,7 Million   (24 BitsPerPixel)
Number of unique colors = 83260
Disk size = 918.01 KB (940.042 Bytes)
Current memory size = 20.61  MB (21.607.720 Bytes)
File date/time = 2010-02-10 / 21:59:07

- EXIF -
Make - Canon
Model - N650U
ExifOffset - 86
DateTimeDigitized - 2010:02:10 21:59:01

> exiftool  Scan-100210-0001.jpg
ExifTool Version Number         : 9.73
File Name                       : Scan-100210-0001.jpg
Directory                       : .
File Size                       : 884 kB
File Modification Date/Time     : 2010:02:10 21:21:28+01:00
File Access Date/Time           : 2010:02:10 21:21:22+01:00
File Creation Date/Time         : 2010:02:10 21:21:22+01:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : inches
X Resolution                    : 300
Y Resolution                    : 300
Exif Byte Order                 : Little-endian (Intel, II)
Make                            : Canon
Camera Model Name               : N650U
Page Name                       : Reflective
Create Date                     : 2010:02:10 20:21:22
Image Width                     : 2202
Image Height                    : 3264
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 2202x3264

> nconvert -fullinfo Scan-100210-0001.jpg 2>Nul
** NCONVERT v6.88 (c) 1991-2016 Pierre-E Gougelet (Apr 29 2016/17:06:08) **
        Version for Windows Xp/Vista/7 x64  (All rights reserved)
** This is freeware software (for non-commercial use)
Scan-100210-0001.jpg : Success
    Format               : JPEG TrueColor (v1.1)
    Name                 : jpeg
    Compression          : JPEG
    Width                : 2202
    Height               : 3264
    Components per pixel : 3
    Bits per component   : 8
    Depth                : 24
    # colors             : 16777216
    Color model          : RGB
    Bytes Per Plane      : 6606
    Orientation          : Top Left
    Xdpi                 : 300
    Ydpi                 : 300
    Page(s)              : 1
    Metadata             : ( EXIF )
EXIF:
  Camera:
    Camera Manufacturer  (0x010f): Canon
    Camera Model         (0x0110): N650U
  Image:
    Date digitized       (0x9004): 2010:02:10 20:21:22

With more or less effort the output can be filtered to the relevant properties and formatted the way you want with batch files.


Without installing external programs: tooltipinfo.bat or imginfo.bat - just pass the file name (or path if it's not in the same directory) to get the information.