0 votes

Hi, I try to create an image with float data in it (32bit Format.RF).

I have an array of float, I need to transform it in an array of bytes (PoolByteArray) to pass it as parameter of create_from_data() so I can create the image.

Here is what I did :

    var byte_array:PoolByteArray
for i in range(layer_count):
    var arr = []
    for j in range(neuron_max):

var wimg = Image.new()
wimg.create_from_data(neuron_max,layer_count,false, Image.FORMAT_RF, weights)

Error :

E 0:00:02.567   create: Expected data size of 108 bytes in Image::create(), got instead 3 bytes.

Thank you for your precious help !

Godot version 3.3
in Engine by (12 points)

1 Answer

0 votes

You created byte_array, but passed weights to create_from_data method. Shouldn't it be wimg.create_from_data(neuron_max,layer_count,false, Image.FORMAT_RF, byte_array)?

by (1,314 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 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 webmaster@godotengine.org with your username.