The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.
nextjs, im asking the user to upload a file by input type=‘file’, then I send that file with formData() to my backend /api, and I place the file path into fs.createReadStream(path)
If the user uploads a malformed PNG, though, it still might not work.
I found this NextJS code that might help? They seem to be reading it a bit differently…
{
const {fileName, maskFileName, prompt, n, size} = req.body;
const result = await openai.createImageEdit(
createReadStream(fileName) as unknown as File,
createReadStream(maskFileName) as unknown as File,
prompt,
n,
size,
);
res.status(200).json({ result: result.data.data });
}
I think the docs code only has a nodejs and cURL example…
I wonder if anyone’s put together a definitive list of the basics in all languages… Hrm…
Anyway, hope this points you in the right direction! Sorry I couldn’t be more helpful.