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!
Update
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.
Best Answer
Using ExifTool (portable executable renamed to exiftool.exe):
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:
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:
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)!