Skip to content
Hands-on4 min readPublished 2026-12-02Reviewed 2027-12-02

How far to compress an image before it enters the model: tokens follow pixel size, not JPEG quality ​

Applies to gpt-6-astra vision input (detail accepts low, high, original or auto). The patch billing rules and defaults come from OpenAI's Images and vision guide, checked on 2026-12-02.

Phone screenshots, scanned pages, exported dashboards: the reflex is to shrink them before sending. But what to shrink, and how far, usually rests on two habits that no longer hold: that auto will fit the image under 2048 px for you, and that a lower JPEG quality saves tokens. On the current sizing table neither is true. Here is the arithmetic, then a measured A4 page to show where the text stops surviving.

The default is auto, and auto equals original ​

In the official sizing table, the four levels behave very differently for gpt-6-astra:

detailBehavior
lowFits within 512 x 512
highLongest side up to 65,535 px, and at most 2,500 patches
originalKeeps the original dimensions unless a side exceeds 65,535 px
autoSame as original

Omitting detail gives you auto, so the default path does not downscale. A 4000 x 3000 phone screenshot needs ceil(4000/32) x ceil(3000/32) = 125 x 94 = 11,750 patches, times the model multiplier of 1.2, rounded up: 14,100 tokens. The same image under high is scaled to 1,250 x 938 (the 2,500-patch budget), roughly 3,000 tokens.

There is also a hard edge: a request whose processed image exceeds 30,000 patches is rejected, not silently shrunk to 30,000. When that happens the error surfaces as an image-dimension problem, and it is easy to misread as "the file is too big".

Worth checking the formula against the three official examples: 1024² gives 1,024 patches and 1,229 tokens, 2048² becomes 1,600² with 2,500 patches and 3,000 tokens, and 4096 x 512 stays put at 2,048 patches and 2,458 tokens. Recomputing with ceil(ceil(w/32) x ceil(h/32) x 1.2) matches all three.

Tokens follow pixel size only; JPEG quality is not in the formula ​

Patches are cut on a pixel grid, so how the file is encoded never enters the billing basis. One 1335 x 1888 image, saved four ways:

EncodingSizePatchesTokensCharacter error rate
PNG153 KB2,4782,9744.0%
JPEG q8591 KB2,4782,9744.0%
JPEG q6072 KB2,4782,9744.8%
JPEG q4065 KB2,4782,9743.6%

q40 brings the file down to 42% of the PNG and removes exactly zero tokens; the error-rate movement sits inside the noise of a single page, so it is not evidence that harsher compression is more accurate. The conclusion is blunt: use JPEG to cut bytes, change dimensions to cut tokens. The former affects upload time, base64 payload and timeout odds; only the latter reaches the invoice.

One A4 page, measured: 512 loses everything, 1024 is the floor ​

The test target is a synthetic A4 Chinese document at 200 dpi (1,654 x 2,339 px): 12 lines, 250 effective characters, with order numbers, amounts and dates. Each tier was scaled by the official dimension and patch-budget rules with LANCZOS resampling, then read by tesseract 4.1.1 (chi_sim, psm 6) and scored as character error rate. Environment: Python 3.12.11, Pillow 10.4.0, sample size one page.

TierSize after scalingPatchesTokensCharacter error rate
low equivalent (512)362 x 512192231100.0%
longest side 768543 x 76840849084.8%
longest side 1024724 x 1,02473688415.6%
high budget1,335 x 1,8882,4782,9744.0%
no scaling1,654 x 2,3393,8484,6184.4%

Three conclusions you can act on:

  1. low is unreadable for small Chinese body text. The 512 tier costs 231 tokens and misses 100% of characters — not "a bit blurry", but the whole page. low answers "what is this image roughly", not "what does it say".
  2. The knee sits near 1024, not 2048. At 768 eight characters in ten are still wrong, at 1024 the rate drops to 15.6%, and at the high budget (about 2,478 patches) only 4.0% remains.
  3. More pixels past that buy no accuracy. Not scaling costs 55% more tokens than the high budget and scores 0.4 points worse — at this size the extra pixels are noise.

Note that this is OCR error rate, a measure of whether the glyphs still exist at the pixel level, and therefore a lower bound on what a model can read: what tesseract cannot resolve, a model will not resolve either; what tesseract resolves, a model may still misread. For the model's own accuracy, run a second round on your business samples instead of treating this table as model accuracy.

Size by patch budget, not by a favorite long edge ​

Rather than remembering "shrink to 1024", derive the scale from the patch budget so the same snippet holds for any input size:

python
import math
from PIL import Image

BUDGET, MULT = 2500, 1.2          # gpt-6-astra: 2500 patches at high, multiplier 1.2
img = Image.open(src); w, h = img.size
if math.ceil(w/32) * math.ceil(h/32) > BUDGET:
    sf = math.sqrt(32**2 * BUDGET / (w*h))       # simplified form of the official scaling rule
    nw, nh = int(w*sf), int(h*sf)
    img = img.resize((nw, nh), Image.LANCZOS)     # resize first, save after
img.save(dst, "JPEG", quality=80)                 # bytes go to quality, pixels go to the patch budget

Three rules that go with it:

  • Count patches before choosing a tier. Estimate tokens as ceil(patch x 1.2) and multiply by the input price to see what the image is worth; for document images below roughly 1,000 tokens, do not expect small text to survive.
  • Do not use low for text-dense images. The official limitations page says to enlarge small text and to use original where available. For coordinate work (OCR boxes, clicking) use original, downscale yourself within the pixel limits, and map returned coordinates back to the original image.
  • auto is not a safe fallback. It equals original on gpt-6-astra and also on the gpt-5.6 family; if you want cost control, write high explicitly or resize yourself.

One line to close: bytes to JPEG, pixels to the patch budget, tier written explicitly — three separate levers for transfer, invoice and legibility. Mix them up and you pay more for a worse read.

OpenAIChat · Full-stack engineering for LLM-powered conversations and apps