0 votes

I am trying to load an image to get pixels from it. The code I am using is Image.load("res://image.png") This works in the editor, but not on export, as the error says. The file in imported as a Texture, and the full error is: Loaded resource as image file, this will not work on export: 'res://image.png'. Instead, import the image file as an Image resource and load it normally as a resource.

Godot version 3.1.1
in Engine by (157 points)

1 Answer

0 votes

Try using load("res://image.png") directly. It should return you a Texture, which has a get_data() function.

by (2,720 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.