Skip to Content
Mika Scraper 1.1.1 is released ๐ŸŽ‰
๐Ÿƒ MIKA FUNCTIONFunction: GPTImageCanvas()

Mika Scraper v1.1.2


Mika Scraper / GPTImageCanvas

Function: GPTImageCanvas()

GPTImageCanvas(imageUrl, prompt, apiKey): Promise<null | string>

Defined in: src/_other-scraper/gpt.ts:70

Edits an image using the OpenAI DALL-E image editing API. This function allows you to submit an image and a text prompt to generate an edited version of the image according to your specifications.

Parameters

imageUrl

string

The URL of the image to be edited. This should be a publicly accessible image link.

prompt

string

A text description of the desired edits to be applied to the image. The clarity and detail of this prompt can significantly affect the quality and relevance of the result.

apiKey

string

Your OpenAI API key. If this parameter is not provided

Returns

Promise<null | string>

The function returns a Promise that resolves to either a base64 encoded string representing the edited image or null if an error occurs during the process.

Throws

The function may throw an error in the following scenarios:

  • If the image download from the provided URL fails.
  • If the API request to OpenAI fails.
  • If the response does not contain a valid base64 encoded image.

Example

const editedImage = await GPTImageCanvas( "https://example.com/image.jpg", "Add a sunset background", "your-openai-api-key" );

Diagram: Mika Scraper

Last updated on