PDA

View Full Version : Getting Image Size via MEL


AlphaJoe
06-13-2007, 08:51 PM
Does anyone know how to query the image size of an external file via MEL? I have found a couple of references here regarding ways of doing this, but one has code that no longer works in 8.5, and the other didn't post the code, but had a link to an external site that no longer exists.

Thanks,

azshall
06-14-2007, 12:35 AM
Albeit, its not the cleanest method but it works.

You can create a file texture node and map the image to it then query this attribute... ie

float $resolution[] = `getAttr file1.outSize`;

if your image was say 640x480 you would get

$resolution[0] = 640
$resolution[1] = 480

Then just delete the file texture node once you have the data you need. sloppy, but gets the job done :)

Seth

AlphaJoe
06-20-2007, 11:35 PM
Thanks, I will give that a try. It is dirty, but if it works, so be it.



Albeit, its not the cleanest method but it works.

You can create a file texture node and map the image to it then query this attribute... ie

float $resolution[] = `getAttr file1.outSize`;

if your image was say 640x480 you would get

$resolution[0] = 640
$resolution[1] = 480

Then just delete the file texture node once you have the data you need. sloppy, but gets the job done :)

Seth

CGTalk Moderation
06-20-2007, 11:36 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.