Photo or screenshot? Why a JPEG converter picks quality 80 or 88
A converter that turns WebP into JPG has to pick a quality number, and the sensible number is not the same for a photo and for a screenshot. In the setup used here, a photo gets 80 and a screenshot gets 88. Give the phot
A converter that turns WebP into JPG has to pick a quality number, and the sensible number is not the same for a photo and for a screenshot. In the setup used here, a photo gets 80 and a screenshot gets 88. Give the photo 88 anyway and it grows by 36.3% to 39.2% while the similarity score barely moves. This post builds that idea from one photo and one screenshot, so a beginner can see why a converter bothers to look at what is inside the picture first.
What the quality number means
JPEG throws away detail to save bytes, and the quality number (0 to 100) says how much to throw away. Higher means fewer bytes lost and a bigger file. The tricky part is that the same number does not look the same on every picture. The usual explanation is that a photo is full of soft noise and gradual shifts, so small errors hide in it, while a screenshot has flat colour and sharp letter edges, so the same errors collect next to the text. That explanation was not tested here; only bytes and SSIM were measured.
So a default cannot be one number. Whoever picked it had to guess what kind of image would come in.
Two samples, two tiers
The numbers below come from the lake photo and a self-made table screenshot, both re-encoded as JPEG at four qualities. Sizes are bytes. SSIM is a 0 to 1 similarity score against the lossless original; it is a luminance-only version implemented for this comparison, and nobody judged these images by eye.
| Sample | Quality 80 | Quality 88 | 88 vs 80 |
|---|---|---|---|
| Lake photo (1600Γ1067) | 178,795 B, SSIM 0.9674 | 248,925 B, SSIM 0.9764 | +39.2% bytes, +0.0090 SSIM |
| Table screenshot (1440Γ900) | 118,280 B, SSIM 0.9942 | 143,289 B, SSIM 0.9972 | +21.1% bytes, +0.0030 SSIM |
Read the photo row first. Going from 80 to 88 costs about 70 KB (counting 1 KB as 1,000 bytes, a subtraction of the two byte counts, not a separate measurement) and the score moves by under 0.01. On the airport photo with a big sky the cost was 36.3% for +0.0084, and across four photos the range was 36.3% to 39.2%.
The screenshot row looks cheaper, and it is: 21.1% for +0.0030. But the score is the less useful number here. Zoom the text of the screenshot to six times and the difference is easy to see. At quality 50 there is a grey speckle around the letters, at 80 a faint ring is still there, and at 88 it looks close to the original. The extra bytes are a smaller share on a screenshot and the speckle is easy to spot, so 88 is the better place to stand in this setup.
What happens when the guess is wrong
Because the screenshot tier is higher than the photo tier in this setup, the two mistakes are not symmetric.
A photo treated as a screenshot gets 88 instead of 80. It grows by 36.3% to 39.2% and gains at most 0.0090 of SSIM. A screenshot treated as a photo gets 80 instead of 88. It shrinks, by about 17% for the table screenshot (1 β 118,280 / 143,289, arithmetic on two measured sizes), and across eight screenshots, text pages and illustrations the 88 versions were 21.1% to 29.6% larger than the 80 ones. The price is a slightly lower score, 0.0010 to 0.0067, and the extra ring around letters.
So a wrong guess either wastes bytes or smudges text. Neither breaks anything, which is probably why a converter can get away with a rough classifier.
Where one converter's page shows the tiers
The page at https://imging.ai/ is ImgIng, a browser-based image tool, and it shows this decision openly. After you drop an image in, it prints a content label such as Photo detected or Screenshot/UI detected, and when the output is JPG it offers four default qualities: 80 for photos, 78 for smooth images, 84 for textured ones, 88 for graphics and text. The 80-versus-88 pair above is taken from those tiers.
One real example from the same twelve samples: the airport photo, whose top half is mostly sky, was labelled Screenshot/UI detected, so its WebP-to-JPG default became 88. The result was 317,542 B, which is 2.00 times the original WebP of 158,934 B. The lake photo and the portrait got 80 and came out at 1.41 and 1.43 times.
What the numbers do not cover
These are twelve sample images on one Apple silicon Mac, encoded once with the JPEG encoder inside Pillow (libjpeg-turbo, 4:2:0 chroma). Another encoder will give different byte counts. Between 78, 80, 84 and 88 there was no obvious knee: each extra 0.001 of SSIM cost somewhere between 2.9% and 7.5% more bytes, rising slowly. Costs got steep only above 88, for example 6.3% to 13.2% per 0.001 on the screenshots going from 88 to 92. The photos are CC0 from Wikimedia Commons, resized or cropped: Bonnie Moreland, "Lake Mountain Landscape"; William Stitt, "Face portrait"; and "Avions Γ l'aΓ©roport de Madrid - 2015". The web-page screenshot sample is by Stefan KΓΌhn (CC0), the scanned page is from the 1986 edition of the Table of Simplified Chinese Characters (public domain mark), and the illustrations are by Toby8991 and oksmith (CC0) plus one self-made. The table screenshot, the other screenshots and the text page are self-made with fictional data.
A small habit to try
Next time a converter hands back a JPG far bigger than the source, look at two things: which quality it used, and whether the picture is a photo. If it is a photo and the quality is in the high 80s, dropping to around 80 is a reasonable first try. If it is a screenshot with small text, keep it high, or keep the WebP for that file.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.