def getTextureRAM(mesh):
    total_image_area = 0
    for cimg in mesh.images:
        pilimg = cimg.pilimage
        
        if pilimg:
            total_image_area += pilimg.size[0] * pilimg.size[1] * len(pilimg.getbands())
        else:
            #PIL doesn't support DDS, so if loading failed, try and load it as a DDS with panda3d
            imgdata = cimg.data
            
            #if we can't even load the image's data, can't convert
            if imgdata is None:
                continue
            
            try:
                from panda3d.core import Texture
                from panda3d.core import StringStream
            except __HOLE__:
                #if panda3d isn't installed and PIL failed, can't convert
                continue
            
            t = Texture()
            try:
                success = t.readDds(StringStream(imgdata))
            except:
                success = 1
            if success == 0:
                #failed to load as DDS, so let's give up
                continue
            total_image_area += t.getXSize() * t.getYSize() * 3

    return total_image_area
dataset/ETHPy150Open pycollada/meshtool/meshtool/filters/print_filters/print_render_info.py/getTextureRAM