Function draw.imagesave
This function is used to save images for later use with the draw.image, draw.transformedimage, and draw.tiledimage functions.
Arguments string file, numbers x1, y1, x2, y2
Returns Nothing
Description Saves an image to the hard drive, where it can then be used when drawing with the draw.image or draw.transformedimage function.
Origin Touch Lua 1.3.1 and Touch Lua+ 1.3
Library draw

draw.imagesave is a Touch Lua function in the draw library. It is used to create images for use with drawing.

Example script which uses draw.imagesaveEdit

draw.setscreen(1) -- shows the graphical screen.
local width, height = draw.getport() -- gets the width and height of the screen.
draw.beginframe() -- starts the frame.
for k=1, 20 do
     draw.fillrect(math.random()*width, math.random()*height, math.random()*width, math.random()*height,
     draw.fillroundedrect(math.random()*width, math.random()*height, math.random()*width, math.random()*height, math.random()*48, draw.gray)
draw.string("Hello Graphics screen!", 48, 48, -- draws a string to the screen.
draw.endframe() -- we are done, draw to the screen.
for k=1, 4 do
     local x, y = draw.waittouch()
     draw.image("@resources/Asteroid1.png", x, y) -- draw an asteroid at the tapped position
     draw.refresh() -- refresh the screen
draw.imagesave("@resources/newimage.png", 0, 0, width, height)
draw.string("Image saved at '@resources/newimage.png'. Tap the screen to draw the image.", 48, 48,
-- draw the image
draw.image("@resources/newimage.png", 0, 0)
-- wait.
draw.string("Tap the screen to end the script.", 48, 48,

Potential errors when using draw.imagesaveEdit

  • Insert potential errors that can be thrown when this function or keyword is called or used incorrectly.

Bugs with draw.imagesaveEdit

  • Insert bugs found with the functioning of this function.
  • In Touch Lua 1.3.1, when this function is given an invalid file address for the first argument, instead of an error being thrown, Touch Lua crashes to the home screen. This bug has been fixed in Touch Lua 1.3.2, where it will work properly.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.