Constructor
Returns
Image
Properties
[number, number]
required
Returns the image dimensions as
[width, height] in pixels.Methods
base64()
Returns
string
base64DataUrl()
data:image/png;base64,..., data:image/jpeg;base64,...,
data:image/gif;base64,..., or data:image/webp;base64,....
Returns
string
compress()
Parameters
number
required
drawBox()
bounds on the image.
Useful for visualizing bounding boxes returned from grounding, element /
layout queries, ground-truth annotations, etc.
bounds is in image-pixel coordinates and covers [left, right) × [top, bottom) (right / bottom exclusive, matching a BoundingBox).
The border is thickness pixels wide, drawn inset within that range so
nothing is painted outside it, in the opaque RGB (red, green, blue)
color. Pixels that fall outside the image bounds are silently clipped, so
it is safe to call with a box that extends past the image. Throws when
thickness is 0 or bounds is degenerate (right <= left or
bottom <= top).
Parameters
BoundingBox
required
number
required
number
required
number
required
number
required
drawDot()
x / y are image-pixel coordinates of the disc’s centre. radius
is the disc radius in pixels (0 paints a single pixel at the
centre). (red, green, blue) is the fill color; alpha is always 255
(opaque replacement of the underlying pixel).
Coordinates that fall outside the image bounds (negative, or past the
width / height) silently produce no pixel, so the helper is safe to
call with the raw output of a grounding model even at the edge of the
captured rect.
Parameters
number
required
number
required
number
required
number
required
number
required
number
required
drawGrid()
width and height.
Parameters
number
required
number
required
fromBase64()
Parameters
string
required
Returns
Image
ground()
concept on this image using the given grounding model and
return absolute zero-based pixel coordinates [x, y].
Equivalent to model.ground(image, concept)
Parameters
GroundingModel
required
string
required
Returns
[number, number]
save()
Parameters
string
required
shrink()
Parameters
number
required
number
required

