# Query texture size - pixels

**URL:** https://forum.highend3d.com/t/query-texture-size-pixels/5899
**Category:** Maya
**Tags:** mel
**Created:** [August 26, 2002, 12:49pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899 "2002-08-26T12:49:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [August 26, 2002, 12:49pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899/1 "2002-08-26T12:49:44Z")

</div>

Is there any way I can query the size of a texture file using MEL? In other words, I have a file node and I would like to know the pixel dimension of that image.

--JeffD

---

<div class="post-metadata">

### Author: ![jugdish](https://forum.highend3d.com/user_avatar/forum.highend3d.com/jugdish/32/54716_2.png) [@jugdish](https://forum.highend3d.com/u/jugdish)
#### Post date: [August 26, 2002, 1:37pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899/2 "2002-08-26T13:37:04Z")

</div>

Here's one way. May not be the best.

Included in the dev kit examples is a command plugin that will return the resolution of an image. I think it's called iffInfoCmd.

- Matthew Durante

---

<div class="post-metadata">

### Author: ![gdc](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gdc](https://forum.highend3d.com/u/gdc)
#### Post date: [August 26, 2002, 3:09pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899/3 "2002-08-26T15:09:08Z")

</div>

You can use the .outSizeX and .outSizeY attr on the file node to get the size in pixles.

string $xSize = `getAttr ("file1.outSizeX")`;

I have had some problems with this reporting back the wrong size when the texture is higher than it is wide. Usually it give the x value for y and y for x in these cases.  
When I need to really know I'm getting the right values I use a system call to imageMagick.

Hope that helps  
--g

---

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [August 26, 2002, 5:44pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899/4 "2002-08-26T17:44:17Z")

</div>

Great tip. I am a bit concerned about it reporting back the wrong size, though.

Great tip on ImageMagick! It looks like it is going to do some other things I need to do in my script also. I'm downloading it now!

--JeffD

---

<div class="post-metadata">

### Author: ![gdc](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/g/898d66/32.png) [@gdc](https://forum.highend3d.com/u/gdc)
#### Post date: [August 26, 2002, 6:24pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899/5 "2002-08-26T18:24:32Z")

</div>

yeah ImageMagick rocks, it's just too bad the system calls are so damn slow!  
Also keep in mind that Maya ships with some imageMagick tools...  
imconvert and imgcvt are both build off of imageMagick.

--g

---

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [August 27, 2002, 5:21pm UTC](https://forum.highend3d.com/t/query-texture-size-pixels/5899/6 "2002-08-27T17:21:23Z")

</div>

Yeah, I noticed those in the Maya bin while searching my machine for conflicts on the default command names.

My head is spinning with all the new stuff I could do with this suite of tools.

Thanks again.

--JeffD
