Function for modifying images using version 2 of the API. It sends a request to the Image Modification V2 AI Model and returns the new image. Read more about the model here https://docs.worqhat.com/ai-models/image-generation/image-image-v2

Parameters

ParameterTypeDescription
existing_imageFile or stringThe existing image to be modified. It can be a File object, a URL, or base64 encoded image data. This is a required parameter.
modificationsstringThe modifications to be made to the image. This is a required parameter.
outputTypeurl blobThe output type of the modified image. It can be either url or blob. This is an optional parameter.
similaritynumberThe similarity percentage for the image modification. This is a required parameter.

Initialize AI Modules

const worqhat = require('worqhat');

var config = new worqhat.Configuration({
    apiKey: "your-api-key",
    debug: true,
    max_retries: 3,
});

worqhat.initializeApp(config);

let ai = worqhat.ai();

Implementation

ai.imageVariations.v3({
    existing_image: '1692628607418.png',
    outputType: 'url',
    modification: 'change the background to yellow',
    similarity: 70
}).then((response) => {
    console.log(response);
}).catch((error) => {
    console.log(error);
});