okamstudio/godot — pull request #420 by cjmxp (2014-05-15 03:31:10+00:00)
Title: New API: load_image_buffer

void load_image_buffer(const DVector& p_buffer, uint8_t type);

New API: load_image_buffer

ImageTexture load_image_buffer from a ByteArray

GDScript Example:

func _init():
var file = File.new()
file.open("res://test.png",1) # 0 == .jpg 1 == .png 2 == .webp
var db = file.get_buffer(file.get_len())
file.close()
var img = ImageTexture.new()
img.set_flags(0)
img.load_image_buffer(db,1)
var sprite = Sprite.new()
sprite.set_texture(img)
sprite.set_centered(false)
get_root().add_child(sprite)