Skip to main content

Constructor

Returns

Screenshot

Properties

[number, number]
required
Returns the screenshot dimensions as [width, height] in pixels.

Methods

addGrid()

Draws a cross-hair grid on the image. Grid squares have the specified width and height.

Parameters

number
required
number
required

base64()

Returns the image encoded as a base64 data URL. The result includes the MIME prefix, for example data:image/png;base64,... or data:image/jpeg;base64,....

Returns

string

compress()

Compress the image by converting it to JPEG with the specified quality. The quality is a value between 1 and 100. 1 is the lowest possible quality and 100 is the highest quality.

Parameters

number
required

ground()

Locate concept on this screenshot using the given grounding model and return the corresponding global physical pixel coordinates [x, y]. The output can be fed directly to primitives that expect global screen coordinates. Equivalent to model.ground(screenshot, concept).

Parameters

GroundingModel
required
string
required

Returns

[number, number]

save()

Path includes the file name and the extension.

Parameters

string
required

shrink()

Resizes this image if it is larger than the desired size. The image’s aspect ratio is preserved. The image is scaled to the maximum possible size that fits within the bounds specified by nwidth and nheight. This method operates on pixel channel values directly without taking into account color space data. We commonly use this to resize the image to 1920x1080.

Parameters

number
required
number
required

toGlobalPhysicalPixels()

Converts a point in this screenshot to global physical pixel coordinates. Screenshots may represent only part of a display, and displays may use different scale factors. Use this to map (x, y) to the corresponding global physical pixel position (for example, when moving the mouse to the same on-screen point). See ScreenshotCoordinateType for how coord_type affects interpretation of (x, y).

Parameters

number
required
number
required
ScreenshotCoordinateType
required

Returns

[number, number]