--- /dev/null
+class Texture:
+ def __init__(self, tex_node, channels):
+ self.image = tex_node.image
+
+ self.srgb = self.image.colorspace_settings.name=='sRGB'
+ if len(channels)==1 and self.srgb:
+ raise Exception("Unsupported configuration on texture {}: Grayscale with sRGB".format(self.image.name))
+
+ if len(channels)==4:
+ self.pixelformat = 'SRGB8_ALPHA8' if self.srgb else 'RGBA8'
+ elif len(channels)==1:
+ self.pixelformat = 'LUMINANCE8' if channels[0]=='Y' else 'R8'
+ else:
+ self.pixelformat = 'SRGB8' if self.srgb else 'RGB8'
+
+ self.width = self.image.size[0]
+ self.height = self.image.size[1]