Image editing options.
A promise resolving to the edit result with image data and metadata.
When the resolved provider does not implement image editing.
When no provider can be determined or credentials are missing.
// Img2img transformation
const result = await editImage({
provider: 'stability',
image: fs.readFileSync('landscape.png'),
prompt: 'Convert the daytime scene to a starry night.',
strength: 0.7,
});
// Inpainting with mask
const inpainted = await editImage({
provider: 'openai',
image: 'data:image/png;base64,...',
mask: 'data:image/png;base64,...',
prompt: 'Replace the sky with aurora borealis.',
mode: 'inpaint',
});
Edits an image using a provider-agnostic interface.
Resolves credentials via
resolveMediaProvider(), initialises the matching image provider, converts the input image to aBuffer, and dispatches to the provider'seditImagemethod.