Imagemagick can do this - I've just had a go for you....
C:\temp>identify test.tga
test.tga TGA 745x1053 745x1053+0+0 8-bit DirectClass 2.353MBB 0.218u 0:00.228
You can also control the output of the command - for example:
C:\temp>identify -format "%f,%w,%h" test.tga
test.tga,745,1053
Edit: You could save the output parameters in a few ways, but off the top of my head, if you are already working with batch files, you could use the identify command to create its own batch file and then run it in a way that the variables become command line parameters - for example:
tgachk.bat:
@ECHO OFF
identify -format "tgachk2.bat %f %w %h" test.tga > tgatmp.bat
tgatmp
The above script creates tgatmp.bat 'on the fly' and then runs it, which in turn runs tgachk2.bat with the %f %w and %h variables as command line parameters you can refer to as %1 %2 and %3.
tgachk2.bat:
@ECHO OFF
ECHO The parameters were: %1 %2 and %3
There are other ways of doing this, but hopefully the above is easy to follow and edit to include any other steps you need to complete.
How would we store those outputs as variables? – Andrew – 2011-08-16T17:26:56.837
@Andrew I have edited my answer to cover this – Linker3000 – 2011-08-16T19:24:29.580