GPT-4 Vision File Size Limitations

Hello, I am using the OpenAI api with gpt-4-vision-preview, and when submitting a file near the maximum of 20MB for image processing, it will fail with “file to large”, though the file itself, with base64 encoding sent via the API, at 15MB is less than the stated limit.
Is the limit of the unencoded file (20MB) or the encoded file, or otherwise? I handle the issue gracefully, but I can constrain my images to ensure all flow through.

It seems you are simply sending large images wastefully when you already have them within your control.

The API does its own internal multi-step resizing, and the maximum image that you can possibly have interpreted after this auto-resizing is 2048x768 (consuming 8 “tiles”). Uncompressed, that’s 1.5M pixels, or 4.5MB true color.

The shortest side is no bigger than 768px, and the longest side is no bigger than 2048px when passed to the model.

You can use the same resize logic that OpenAI does, and also improve the responsiveness with smaller network transmission and eliminating image resize on the server side.

1 Like