Gpt image 1 output formatting - how to convert to png or jpeg to send back to lovable.dev front end

How do i convert the binary gpt image 1 output into a usable image that i can send back via a webhook to lovable.dev front end and be able to acutally use the image.

Here’s what happens so far.

  1. Webhook sends prompt from lovable.dev front end.
  2. gpt Image 1 creates an image from the prompt and the output is a binary code.
  3. Next i need to change this into an actual image. so far, i can do this using google drive but then when i download the google drive image file, its in a google drive format and then when the webhook sends it back to lovable.dev front end, lovable cant access it.

So, if anyone has a suggestion on how I can do this, please let me know. Perhaps i don’t need to use google drive? is their a simple way to turn the binary into a usable jpeg or png file that i can then send via the webhook response to lovable.dev front end?

Hey Ryan,

can you share the input and output bundles too?

Usually the toBinary() function should do the trick to convert a base64 encoding to a file.