The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Is there any way, when using the ResourceLoader to load an image directly (not going through a texture) to tell it up front that it should be stored as FORMAT_R8? I'm pulling in a pretty large image that only contains an alpha channel, and while I can convert it right after load, it feels like not the most efficient use of memory.

in Engine by (24 points)

I haven't used it much, but are you aware of the Image class?

Yes, that's what I'm using to load it. But it doesn't let me specify the format at load time.

(Currently messing with different file formats to see if I can get Godot to auto-detect what the file is.)

Ah, yeah, got it. Poking around, I wonder about...

  • Load the raw data via File.get_buffer() to load the data as a PoolByteArray
  • Create the image via Image.create_from_data() which accepts the data from a PoolByteArray and allows a format to be specified...

Though, I've never tried it...

Please log in or register to answer this question.

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.