#"Image is not defined" error with edit image endpoint

2 messages · Page 1 of 1 (latest)

analog basin
#

so this is my first time working w/ any of the image endpoints and i'm confused on why this is failing.

in the docs for the images/edits endpoint it says that you should pass a "valid PNG file" to the image param - and this is what i'm doing.

i'm passing a png File object that looks like this:

File {
  [Symbol(kHandle)]: Blob {  },
  [Symbol(kLength)]: 210264,
  [Symbol(kType)]: 'image/png',
  [Symbol(state)]: { name: 'blob', lastModified: 1685821416980 }
}

this is how i'm passing it to the endpoint:

  const response = await openai.createImageEdit({
          image: baseimage,
          prompt: chatleapprompt,
          n: 1,
          size: "512x512"
   })

however, i keep getting this error:
Error while making request to external API: Image is not defined

i've read through the forums and it seems like most people are using fs and creating a readable stream form File path, but on my frontend my users are uploading a File object and this is what i'm passing to my server. should i convert the File to a buffer or something of that sort?

#

"Image is not defined" error with edit image endpoint