Menu

20 resize round trips took a photo from 31.93 to 22.57 dB, and no JPEG was involved
πŸ“°

20 resize round trips took a photo from 31.93 to 22.57 dB, and no JPEG was involved

DEV Community: javascriptΒ·hao jiaΒ·17 days ago
#j0JEWobD
#devtojavascript#devto#dev#jpeg#resize
Long article (908 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Keeping intermediate copies lossless, so that only the last hop pays for JPEG, sounds like enough protection for an image that passes through several services. That assumes JPEG is where the damage happens. A test run on 2026-11-18 put a resize inside a 20-generation save loop, and the lossy encoder turned out to be the smaller problem. With no JPEG step, scaling a 1200Γ—672 photo to 99% and back twenty times took it from 31.93 dB PSNR to 22.57 dB. Everything below is one Apple-silicon Mac, three images and one pass per configuration.

Each round scales to 99 percent and back

Three samples went in as PNG originals: a 1200Γ—672 countryside photo (trees, a stone wall, grass), a 1200Γ—784 lake photo that is mostly smooth water and sky, and a 1200Γ—800 screenshot of a mock admin UI with small text and thin lines. One round shrinks the current image to 99% of its width and height and scales it straight back. The JPEG variant then saves at quality 75 with Pillow (bundled libjpeg-turbo, 4:2:0 chroma) and reloads.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.