I am trying to load big .png files (~10-16 MB, 14000x9600) with PIL. When I load them into a texture I can only use one color channel (I try 3 or 4 and it tells me it doesn't match in size).
The part handling this is:
from PIL import Image`
img = Image.open(loc)
maps.append(self.ctx.texture(img.size, 1, img.tobytes()))
Anything but 1 leads to the error:
_moderngl.Error: data size mismatch 134400000 != 403200000
And of course the decopmressionBomb warning:
DecompressionBombWarning: Image size (134400000 pixels) exceeds limit of 89478485 pixels, could be decompression bomb DOS attack.
I have tried removing the upper bound for image size with Image.MAX_IMAGE_PIXELS = None
but it made no difference.
Any other (smaller) image is able to load just fine, however in another project I had the same issue with a 500x500 .jpg-file. As it stands currently I only get a red-only version of the texture when displayed. Note that the images can be viewed in full color when opened in a viewing application.
Could this just be a hard limit of PIL or is there a way to overcome this? If not, what is the maximum size an image can have?
This might be an approach, but I currently don't think it is applicable to my images.