Picture:save(File | filename) method
Save the Picture image to a file on disk.
Parameters
File | filename
A File object or a filename string, representing the image file whose content will be saveed.
Return value
This function returns true if the image saving succeeded, or false otherwise.Example
local ui = require "ui"
local win = ui.Window("Picture.save() and save() example", 512, 380)
-- create an empty Picture object
local img = ui.Picture(win, "")
-- save the image from disk
img:save(sys.File(arg[0]).path.."\\LuaRT.png")
-- center the Picture on the window
img:center()
-- create a button
local button = ui.Button(win, "Save picture to...")
button:center()
button.y = img.y + img.height + 30
-- button onClick event handler
function button:onClick()
local file = ui.savedialog("Save picture as...", false, "All files (*.*)|*.*|PNG image files (*.png)|*.png|JPEG image files (*.jpg)|*.jpg|Bitmap image files (*.bmp)|*.bmp|GIF image files (*.gif)|*.gif|ICO image files (*.ico)|*.ico|TIFF image files (*.tiff)|*.tiff")
if file ~= nil and (not file.exists or (file.exists and ui.confirm(file.fullpath.." already exists. Continue and overwrite its content ?") == "yes")) then
if img:save(file) then
win:status("Picture saved as "..file.fullpath)
end
end
end
win:center()
win:show()
repeat
ui.update()
until win.visible == false