Godot Version
4.2.1
Question
I am writing a program in Godot that overlays textures on each other. I iterate over each pixel of the image (via Texture.get_image()
) and manipulate their color values. It works perfectly when using textures such as GradientTextures
and NoiseTextures
, which are uncompressed.
When I import a CompressedTexture2D
such as a PNG file and attempt to iterate over each of its pixels, I receive this error: get_image(): Can’t get_pixel() on compressed image, sorry. This makes sense because of how PNGs and many other image formats are stored.
I cannot figure out how to convert a compressed image (from a CompressedTexture2D
) to an uncompressed image so that I can iterate over each pixel. I have tried using the blit_rect()
function, but that does not work either.
How should I go about iterating over the pixels of an Image created from a CompressedTexture2D
?