Images
Images can be added to the prompt for models that support this feature (like gpt-4o
).
Use the defImages
function to declare the images. Supported images will vary
with models but typically include PNG
, JPEG
, WEBP
, and GIF
. Both local files and URLs are supported.
Read more about OpenAI Vision.
URLs
Public URLs (that do not require authentication) will be passed directly to OpenAI.
Local files are loaded and encoded as a data uri.
Buffer, Blob
The defImages
function also supports Buffer
and Blob.
This example takes a screenshot of bing.com and adds it to the images.
Detail
OpenAI supports a “low” / “high” field. An image in “low” detail will be downsampled to 512x512 pixels.
Cropping
You can crop a region of interest from the image.
Auto crop
You can also automatically remove uniform color on the edges of the image.
Greyscale
You can convert the image to greyscale.
Rotate
You can rotate the image.
Scale
You can scale the image.
Flip
You can flip the image.
Max width, max height
You can specify a maximum width, maximum height. GenAIScript will resize the image to fit into the constraints.