I want to load a PoolByteArray of image data into an Image. I'm using this code:
var img = Image.new()
img.create_from_data(64, 64, false, img_data.format, img_data.data)
The image should always have a size of 64x64 pixels. The problem is that sometimes it has a wrong size (because I get it over network). Then Godot prints an error when I call create_from_data
. How can I check if the image data really has a size of 64x64 pixels before I load it?