Saving Texture from Array Color Data (RESOLVED)

Godot Version

V4.5.1

Question

I have color data for a texture stored in an array. How would I export/store this as a texture that 2D objects can use? How must the data be formatted? How do I add or remove these stored textures?

The array is 24x24, And it must be stored as pixel art

If you need a simple example, use an array that is 3x3, and is white with a horizontal black stripe through the middle.


You’ll need to create an Image with Image.create(), fill it with Image.set_pixel(), and create an ImageTexture from that Image with ImageTexture.create_from_image() to assign it to the Sprite2D.texture property.

2 Likes