Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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:


identify -format "tgachk2.bat %f %w %h" test.tga > tgatmp.bat

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.


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .