DEV Community

AsyncMonk
AsyncMonk

Posted on

Which lines survive upscaling a 300px product shot

Every AI upscaler demo shows you the same thing: the blurry input on the left, the sharp output on the right. I stared at a lot of those before realising the comparison cannot answer the one question I actually had. A client had sent me 300×300 product shots for a page that needed 750px wide images, the originals were long gone, and I needed to know whether the batch number printed on the bottle would survive the trip. Before-and-after tells you whether something looks sharp. It tells you nothing about whether it is still the same number.

So I built a sample where I knew the answer in advance. I drew a fictional product label at 1200×1200: a made-up brand called MEIJIA, invented ingredients, an invented lot code, with type ranging from 92px down to 14px. Then I shrank it to 300×300 and upscaled it back 4x, landing exactly on 1200×1200. Now I had ground truth and result at the same size, and I could diff them line by line instead of squinting at them.

I ran the upscaling in ImgIng (https://imging.ai/), which downloads the model into the browser and runs inference locally. With the network panel open across roughly forty runs, the images themselves never left the machine: zero bytes outbound. The only heavy traffic is the model download coming the other way, which people mix up with uploading all the time. For freelance work that distinction matters — unreleased product photos passing through somebody else's server is a conversation I would rather not have.

Ground truth on the left, the same label shrunk 4x and upscaled back on the right

The boundary turned out to be crisp, and it has nothing to do with text versus graphics. What decides everything is how many pixels tall a thing is after the shrink.

The 92px brand name survives the round trip at 23 pixels tall and comes back with clean edges, shippable as is. The 44px latin lettering survives at 11 pixels, every character intact. Flat colour, the bottle silhouette, dividers and rounded corners come back with no colour fringing and no invented texture at all. That is most of the image area, which is why "can I upscale a thumbnail for a product page" is not a yes-or-no question.

The 34px spec line is the boundary itself. At 8.5 pixels tall in the small version, 200 mL comes back correct while the two Chinese characters next to it get swapped for different characters entirely. Digits right, words wrong, on the same line, rendered so cleanly that nothing about it makes you stop and look twice.

Below that it falls apart. The 20px ingredient line is 5 pixels tall after the shrink; of nine characters, three at best are recognisable. The lot code A7K-2291 came back as A7K(2201: the tail of the 9 gone, the hyphen redrawn as an opening bracket. The 14px english footnote became an evenly spaced row of black blocks.

Here is the part I did not expect. I also ran the same small image through plain LANCZOS interpolation, no model involved. The lot code is a blurry mess, and all eight characters are still readable. Interpolation is blurry but honest; the model is sharp but wrong. Blurry tells you that you did not read it, so you go find the original. Sharp tells you that you did.

The metrics agree in a way that is useless in practice. On this sample the best model tier scores 26.48 dB PSNR against ground truth while LANCZOS scores 27.85 dB — the model is 1.37 dB worse. I still shipped the model output, because the interpolated version is too soft to put on a product page. PSNR averages error across the whole frame and does not care whether the wrong pixels are background or a lot code, so it cannot make this call for you. The only criterion that held up was simpler: can I retype this line into the catalogue from the upscaled image?

By that rule, three categories always go back to a human: identifiers such as lot codes, barcodes and order numbers; spec figures such as volume, weight and dimensions; and small-set body text such as ingredient lists and expiry notes. Mistakes anywhere else are cosmetic. Mistakes in those three get products delisted.

One caveat before you copy my numbers: 8.5 pixels is where the line sat for this typeface, this language and this type scale. Change any of them and it moves. Take a sharp photo you already own, shrink it 4x, upscale it back, and diff it against the original. Half an hour, and you get a boundary that actually applies to your own work.

Top comments (0)