Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does anyone know of a command/hack/anything that will give me the dimensions of a TARGA image file in Windows XP?

So far my searches have only turned up either how to resize an image through a batch file, or how to tell the file size through a batch file.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
+1 This is what I was goint to suggest, too. –  jftuga Aug 16 '11 at 17:05
    
How would we store those outputs as variables? –  Andrew Aug 16 '11 at 17:26
    
@Andrew I have edited my answer to cover this –  Linker3000 Aug 16 '11 at 19:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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