Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 1.81 KB

Graphics.CaptureScreen.md

File metadata and controls

63 lines (55 loc) · 1.81 KB

Graphics.CaptureScreen (String, Int32?, Int32?, Int32?, Int32?)

Captures the specified Screen Region in the specified format

Parameters

  • savePath (String) File path on device where to save the screen capture. The extension you specify decides the format. Supported extensions: .jpeg/.jpg, .png, .bmp, .gif(not animated), .ico, .emf, .exif, .tiff, .wmf

  • x (Optional Int32) X position on screen. Defaults to first monitor X start.

  • y (Optional Int32) Y position on screen. Defaults to first monitor Y start.

  • w (Optional Int32) Width of region to capture. Defaults to (all) screens width.

  • h (Optional Int32) Height of region to capture. Defaults to (all) screens height.

Examples

Captures the entire screen to a jpeg file on your desktop

lua:

Graphics.CaptureScreen(Util.PathExpand("%HOMEDRIVE%/%HOMEPATH%/Desktop/capture.jpg"))

Captures a region of 500 sq pixels around the cursor as a png to the desktop.

lua:

local cursor = Cursor.GetPosition()
local size = 500
local halfSize = size * .5
Graphics.CaptureScreen(
    Util.PathExpand("%HOMEDRIVE%/%HOMEPATH%/Desktop/region-capture.png"),
    cursor.X - halfSize,
    cursor.Y - halfSize,
    size,
    size
)

Captures a sequence of images from the screen and saves them to a folder on the desktop (frames/)

lua:

local frame = 1
local frameCount = 30
local framesPerSecond = 5
local interval
interval = SetInterval(function()
   Graphics.CaptureScreen(Util.PathExpand("%HOMEDRIVE%/%HOMEPATH%/Desktop/frames/"..frame..".png"))
   frame = frame + 1

   if(frame > frameCount)then
      ClearInterval(interval)
   end
end, 1000 / framesPerSecond)