What do you mean by size? 
If file size, then use python os.stat() function
If you meant bitmap resolution, then there are multiple options. One trick 
is to create imagePlane and set it's file name - it should show tex res in 
its attributes.

for PNGs I had a snippet around:

def get_image_info(data):
    if is_png(data):
        w, h = struct.unpack('>LL', data[16:24])
        width = int(w)
        height = int(h)
    else:
        raise Exception('not a png image')
    return width, height

def is_png(data):
    return (data[:8] == '\211PNG\r\n\032\n'and (data[12:16] == 'IHDR'))

def GetRes(fName):
    data = None
    with open(fName, 'rb') as f:
        data = f.read()

    if is_png(data):
        return get_image_info(data)
    else:
        return (-1, -1)


-michal

On Wednesday, October 5, 2016 at 3:23:14 PM UTC+2, Mahmoodreza Aarabi wrote:
>
> Hey masters
>
> I have a problem here, i want to get size of all textures that loaded in a 
> scene in maya, paths are loaded from different directories.
>
> there is any idea?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/8c185dc3-ef01-403c-9e51-0a617ae31013%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to