Version: alpha
FUNCTION | |
---|---|
image.load() | load image from buffer |
CONSTANT | |
---|---|
image.TYPE_RGB | RGB image type |
image.TYPE_RGBA | RGBA image type |
image.TYPE_LUMINANCE | luminance image type |
image.load(buffer,[premult])
Load image (PNG or JPEG) from buffer.
PARAMETERS
buffer |
string |
image data buffer |
[premult] |
boolean |
optional flag if alpha should be premultiplied. Defaults to false |
RETURNS
image |
table, nil | object or nil if loading fails. The object is a table with the following fields:
|
EXAMPLES
How to load an image from an URL and create a GUI texture from it:local imgurl = "http://www.site.com/image.png"
http.request(imgurl, "GET", function(self, id, response)
local img = image.load(response.response)
local tx = gui.new_texture("image_node", img.width, img.height, img.type, img.buffer)
end)
RGB image type
RGBA image type
luminance image type