Image upload for analysis fails randomly: help?

I am uploading images (taken on iPhone, uploaded as JPEG) to ChatGPT via the api (gpt-4o-mini, /v1/chat/completions) and having it do some simple image to txt output.

Sometimes an image works fine and sometimes the very same image gives an error:

“You uploaded an unsupported image. Please make sure your image is below 20 MB in size and is of one the following formats: [‘png’, ‘jpeg’, ‘gif’, ‘webp’].”

Size is small, format is valid. And as above, same image… it works perfectly about half the time. The other half I get that error.

Anyone got any ideas what might be up? Thanks.

1 Like

I’m having the same issue. Images that were working before are not getting the error: “You uploaded an unsupported image. Please make sure your image is below 20 MB in size and is of one the following formats: [‘png’, ‘jpeg’, ‘gif’, ‘webp’].”

You upload the same image or different?

Could be that your file end with jpg etc, but it is actually a other format…

@emily4 @tFT , I just had a customer encounter the same issue. Are you submitting an image from an iphone using the image picker? If so, try stripping the exif data first. I have never had to do this before now. Previously, I could submit a UIImage from the image picker to the API without issue. Try this workaround. I hope it helps for you both (and any others that find this):

   ```swift
    guard let imageCopy = myImage.cgImage?.copy() else { return }
    let inputImage = UIImage(cgImage: imageCopy)
    // submit inputImage to OpenAI
    ```
1 Like

Thank you! This did the trick for me as well. Images coming from my Android phone started getting 400 errors from both image url and base64 encoded images, but stripping exif data did the trick.

1 Like