As title goes, is there a script for Win 7 to get printed on a .txt file all the images (JPG, PNG, GIF ecc) inside a folder along with "filename" and "pixels dimension"?
I've tried with dir on command line but only lists name, file size ecc..

Solution with ExifTool

The best deal imo, with the command already coded in the file name of the .exe its totally a drag and drop script to use wherever you want!

For convenience, I've slightly modified the inline file name of the exe to this

ExifTool(-FileName -Imagesize -r -T -w+! %0finfo.txt -ext jpg --ext exe .).exe

This way I've reduced to the minimum the .txt output to a single line per image (-T) and added a recursive option (-r) so that it can process subfolders too.

Solution with ImageMagick

I've placed below my solution with ImageMagick, is pretty quick and simple but ofc requires the library installed.


Using ExifTool (portable executable renamed to exiftool.exe):

exiftool -ImageSize -r .

Here ImageSize is the tag name you're interested in and will print Image Width x Image Height. The -r switch makes it recursively process files in subdirectories.

Custom output string format is simple as well. For example:

exiftool -p "Image Name: \"$FileName\"$/Image Size: $ImageSize$/" -r .

In this case the tag names are preceded by $. $/ prints a newline.

Note: The commands above have to be typed at the command prompt. To redirect the output to a text file you can append > Details.txt to them.

If you want to simply run the program and have it write a text file with the relevant image details, you can rename the executable as follows:

ExifTool(-FileName -Imagesize -w+! %0fDetails.txt -ext gif --ext exe .).exe

This will write all console output (-w) to a file named Details.txt in the current directory. In this case the output will consist of the image names and sizes for all GIFs in the current directory. Further details about the -w parameter, including the meaning of +, ! and %0f are available at the documentation link above.

You can include more extensions to be processed using -ext jpg -ext png and so on, or delete -ext gif altogether to make it read all supported file types (including non-images which you may not want).

--ext exe is used to exclude all EXEs (so that the program's own executable isn't included in the report).

-r can of course be added to enable recursive processing.

There is lots more you can do with the program given how ridiculously powerful it is (and extensible too given that the full Perl source is freely available)!

  • Looks interesting but I'm a bit stuck using it, I've been able to make it output the sizes inside the command window only after I've opened the images with drag-drop. How can I make it create a .txt file with the output? How can I simply drop the .exe in the folder double click and do the magic? Thank you for your answer – Gruber Jun 8 '15 at 5:45
  • @Gruber: Those commands actually have to be typed at the command prompt. To redirect to a text file you can add > Details.txt to the end of the commands. I have a far better one-click solution for your problem however. See the edited answer above. – Karan Jun 8 '15 at 6:29
  • Now that's amazing! Thank you for extending your answer with the script in the .exe file name, ridiculously handy! :) – Gruber Jun 8 '15 at 18:57
  • @Gruber: You're welcome, glad you found it useful. :) – Karan Jun 9 '15 at 7:16

Ok solution with ImageMagick, simple and quick (but ofc requires the library).

Open the cmd line in the folder you are interested (Shift+RightClick inside your folder window and select "Open command window here"), then in the cmd prompt use this

identify -format "%f %wx%h\r" *.jpg > info.txt

Calls for %f filename, %w width and %h height formatted like "WIDTHxHEIGHT"

More info here http://www.imagemagick.org/script/escape.php


There a PowerShell script below that should do it; just change the directories for list and output. I tested under Windows 8.1 and Windows PowerShellISE.

param( $folder = "E:\My Pictures", $outputFile = "E:\details.txt" )
$objShell = New-Object -ComObject Shell.Application
$fileList = @()
$attrList = @{}
$details = ( "Dimensions" )
$objFolder = $objShell.namespace($folder)
for ($attr = 0 ; $attr  -le 500; $attr++)
    $attrName = $objFolder.getDetailsOf($objFolder.items, $attr)
    if ( $attrName -and ( -not $attrList.Contains($attrName) ))
        $attrList.add( $attrName, $attr )
dir $folder -Recurse -Directory | ForEach-Object{
    $objFolder = $objShell.namespace($_.FullName)
    foreach($file in $objFolder.items())
        foreach( $attr in $details)
            $attrValue = $objFolder.getDetailsOf($file, $attrList[$attr])
            if ( $attrValue )
                Add-Member -InputObject $file -MemberType NoteProperty -Name $("A_" + $attr) -value $attrValue
        $fileList += $file
$fileList | Export-Csv $outputFile -Delimiter ','
$fileList | Format-Table
  • This is not working since you set the folders. I'd like to have it works in whatever folder I drop the file script to. How can this be modified? – Gruber Jun 8 '15 at 4:02
  • Use ".' for the current directory, so line 1 becomes: param( $folder = ".", $outputFile = "details.txt" ) – DrMoishe Pippik Jun 8 '15 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.