0 votes

I'm using aseprite for my 2d graphics. Right now I am working on user interface, and I wonder if I can control color Index from script, it would be pretty usefull

Godot version 3.5.1 Stable
in Engine by (26 points)

1 Answer

0 votes

Not quite sure if this is what you're asking for, but you can get a pixel via x and y:

var image = texture_normal.get_data()
Image.lock()

for row in image.get_height():
    for column in image.get_width():
        print(image.get_pixel(column, row))

image.unlock()

At this point, you have an Image with your edited pixels. If you want to draw it on screen using a sprite or a mesh instance, you can create an ImageTexture from it:

texture_normal = ImageTexture.new()
texture_normal.create_from_image(image)
by (731 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.