Capture Screen Image (screen.image)
Declaration
img = screen.image([ left, top, right, bottom ])
Parameters
- left, top, right, bottom
Integer, optional. Image region. Default is full screen.
Returns
- img
Image object. See Image module (image).
Description
Capture the image of the full screen or a region.
This method creates a new image object. For frequent usage, consider callingimage:destroy
to release memory in time: see image:destroy.
Example
-- Examples of screen.image
--
screen.image():save_to_album() -- Full-screen screenshot to album
--
screen.image():save_to_png_file("/var/mobile/1.png") -- Full-screen screenshot to file
--
screen.image(100, 100, 200, 200):save_to_album() -- Capture region and save to album
--
pasteboard.write(screen.image(100, 100, 200, 200):png_data(), "public.png")
-- Write captured region into pasteboard as PNG
Note: Uses :save_to_album
、:save_to_png_file
、:png_data
、pasteboard.write