Skip to content

resultWithImage

resultWithImage(result, imageData, options?): GadgetExecuteResultWithMedia

Defined in: gadgets/helpers.ts:241

Create a result with a single image output.

string

Text result string

Raw image data (PNG, JPEG, GIF, WebP)

Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

ImageOptions

Optional MIME type, description, metadata, cost

GadgetExecuteResultWithMedia

A GadgetExecuteResultWithMedia

const screenshot = await page.screenshot({ type: "png" });
return resultWithImage(
"Screenshot captured",
screenshot,
{ description: "Homepage screenshot", metadata: { width: 1920, height: 1080 } }
);