Save one photo at quality 80 as a JPEG, a WebP and an AVIF, and you get three files of different sizes. Look closely and the three pictures differ too. The number is the same each time, but what it controls is different. Behind it are a 1974 transform, JPEG's rounding tables and prediction tools borrowed from video codecs, and each produces its own kind of artefact.

Comparing settings across formats: a number nobody standardised

No image format defines what "quality 80" means. The JPEG standard, ITU-T Recommendation T.81, has no 0–100 scale. It defines quantization tables, which give one step size for each of the 64 frequency coefficients in a block. Annex K, "Examples and guidelines", contains example tables. They are examples, not quality levels.

The familiar scale comes from the Independent JPEG Group's libjpeg. Its jpeg_quality_scaling function converts "a user-specified quality rating to a percentage scaling factor" for the base tables. The libjpeg documentation calls it "the 0..100 scale recommended by IJG" and warns that the exact mapping may change in future releases. WebP and AVIF encoders have their own 0–100 scales, and those map onto completely different internal parameters.

On the web, a second layer sits on top. The WHATWG HTML Standard defines toBlob(callback, type, quality) for the canvas element. For a format with variable quality, the quality argument is "a number in the range 0.0 to 1.0 inclusive indicating the desired quality level". If the value is outside that range or is not a number, the browser uses its own default. Beyond that, the standard does not say what the number should mean to the encoder. Each browser decides how 0.8 becomes tables or quantizer settings, so the same value can produce different bytes in different browsers.

The Image Compressor uses this API. Its Quality slider runs from 5 to 100, and the browser receives the slider value divided by 100. Everything below happens after that hand-over.

Format Core coding idea What "quality" maps to
JPEG (T.81) 8×8 DCT, quantization tables, Huffman coding Defined by the encoder; libjpeg scales the base tables
PNG Per-row prediction filters, then DEFLATE Nothing: the format is lossless
WebP lossy (VP8) Intra prediction, 4×4 DCT plus Walsh–Hadamard, boolean arithmetic coder Defined by the encoder; VP8 quantizer indices run 0–127
AVIF (AV1) Variable block sizes, many intra-prediction modes, larger transforms Defined by the encoder, mapped onto AV1 coding parameters

Where blocks and halos come from: the DCT and quantization

JPEG is built on the discrete cosine transform (DCT). Nasir Ahmed, T. Natarajan and K. R. Rao introduced it in IEEE Transactions on Computers in January 1974. They showed that for highly correlated signals, the DCT performs close to the Karhunen–Loève transform, which is the theoretical optimum. Photographs are that kind of signal, because a pixel is usually very similar to its neighbours. According to Gregory Wallace's overview, the joint ISO and CCITT committee that built JPEG on the DCT was formed in 1986. The foreword of T.81 says the Recommendation was approved on 18 September 1992. The identical text is also published as ISO/IEC 10918-1.

The DCT rewrites a block of pixels as a weighted sum of cosine patterns. The patterns range from a flat tone (the "DC" coefficient) to finer and finer stripes and checkerboards. The image at the top of this article shows the patterns for a 16×16 block. Baseline JPEG uses 8×8 blocks, so it has 64 patterns per block. In a smooth area such as a sky, most of the content ends up in a few low-frequency coefficients, and the rest are close to zero. The transform itself discards nothing apart from rounding. It only rewrites the block in a form that is easier to simplify.

The simplification is quantization. Each coefficient is divided by its own step from a table and rounded to the nearest integer. With a step of 1, the coefficient survives almost exactly. With a step of 50, every value between about −25 and 25 becomes zero. In a baseline JPEG encoder, this is where most information is lost. Colour conversion and subsampling, covered below, lose a little more. The later stages lose nothing: zig-zag ordering, differential coding of the DC value and Huffman coding only pack the result (T.81). Wallace explains why the steps are uneven. Human vision is less sensitive to fine, high-frequency detail, so those coefficients get much coarser steps than the low-frequency ones that carry shape and shading.

Two familiar artefacts follow directly from this:

  • Blocking: visible squares in skies, skin and smooth gradients. Each 8×8 block is quantized on its own. When only the DC value and a few low-frequency coefficients survive, neighbouring blocks get slightly different flat tones, and the grid shows.
  • Ringing: faint ripples or halos next to sharp edges and text. A sharp edge needs many high-frequency coefficients. When coarse steps round them away, the remaining cosines overshoot around the edge.

In a libjpeg-style encoder, the quality number does nothing except scale the tables. The library source gives the curve:

quality < 50:   scale = 5000 / quality     (percent of the base table)
quality >= 50:  scale = 200 - 2 * quality  (percent of the base table)

At 50 the base tables are used unchanged. At 25 every step doubles, and at 75 every step halves. At 100 the scale reaches 0, and the library then sets every entry to 1, which its comments describe as "minimum quantization loss". Minimum loss is still some loss. Coefficients are still rounded to integers, the colour conversion is rounded, and colour may be stored at a lower resolution. Quality 100 is a very light lossy setting, not a lossless one. T.81 does have a separate lossless mode, but a canvas JPEG export does not use it.

Where smeared colour comes from: chroma subsampling

JPEG files usually do not store red, green and blue directly. They store one luminance (brightness) component and two chroma (colour difference) components. T.81 gives every component its own horizontal and vertical sampling factors, so an encoder may store colour at a lower resolution than brightness. The eye notices fine brightness detail far more than fine colour detail, so this saves bytes at little visible cost.

The libjpeg documentation lists sampling factors of 2,2 for luminance and 1,1 for chroma as its default. That means one colour sample covers a 2×2 group of pixels, the scheme usually written as 4:2:0. The scheme a given browser uses for canvas exports is up to its encoder. When colour resolution is reduced, fine red or blue edges and coloured text on a coloured background suffer first. Colour can bleed past its outline even when the brightness detail stays sharp, and coarse quantization of the chroma components makes it worse.

Hitting a byte budget: why size bends instead of falling evenly

The libjpeg curve shows why file size does not change evenly along the slider. Going from 50 to 60 takes the scale from 100% to 80%, so every step shrinks by a fifth. Going from 90 to 95 takes it from 20% to 10%, so every step halves. In the upper range, a few points mean much finer quantization, more non-zero coefficients and many more bytes. The exact numbers depend on the image. Wallace's account of the committee's tests measures quality in compressed bits per pixel, not in settings. A detailed scene has more coefficients worth keeping than a plain one, so two images saved at the same setting can end up at very different bit rates.

Size rises roughly, though not strictly, with quality, so searching over quality is a sensible way to meet a budget. The Target size goal works this way. It first encodes at 5% as a fallback. Then it runs eight halving steps between 5% and 100%, keeping each midpoint that fits and moving higher, or moving lower when it does not fit.

When at least one encode fits, the result is the highest tested quality that fits, shown as Used quality. That figure tells you how much quality the budget allowed for this image in this format; it is not comparable with the same number in another format.

If even 5% does not fit, the tool returns the 5% encode anyway, and that file can still be larger than the target. There is no separate warning, so check the Compressed size against what you asked for.

The search never changes pixel dimensions, which is why some targets cannot be reached. Below a certain point, size depends mainly on things quality cannot touch: headers, the minimum cost of coding every block, and above all the pixel count. A large photo at the lowest quality is still a large photo. The article on why an image is too large to upload and what actually makes a file smaller covers the practical fixes.

Re-saving a JPEG that was already compressed

Decoding a JPEG and encoding it again quantizes the image a second time, usually with different tables from the first encode (another setting or another encoder). Each round then adds its own rounding error. This is called generation loss. Even with the same encoder and setting, colour conversion and rounding add a little more each time. There is a second effect. The decoded image already carries faint block edges and ripples from the first encode. To the new encoder these look like real high-frequency detail, and keeping them costs bits. So re-saving a compressed JPEG at a high setting can produce a bigger file that looks no better. In the tool this shows as a negative Saving, which means the output is larger than the original.

Saving screenshots and logos: when lossless PNG wins

PNG works on different principles. Under the W3C PNG specification (third edition, a W3C Recommendation of June 2025), each row of pixels first passes through one of five filters: None, Sub, Up, Average or Paeth. A filter replaces each byte with its difference from a prediction based on the pixel to the left, the pixel above, or a mix of neighbours. The result is compressed with DEFLATE, defined in RFC 1951 (L. Peter Deutsch, May 1996). DEFLATE combines LZ77 with Huffman coding. LZ77 replaces repeated sequences with references back into a window of up to 32 KB, and each match is 3 to 258 bytes long.

Nothing in this process discards information, so a quality setting has nothing to control. For PNG output the tool ignores Quality, reports 100% as the quality used, and turns off the size goal. Size depends on how predictable the pixels are. A screenshot with flat colours, sharp text and repeated patterns suits prediction and LZ77 matching, so it stays small. A photo is full of sensor noise and fine texture, so the PNG can be several times bigger than a JPEG of the same picture.

PNG supports full alpha transparency. However, this tool paints its canvas white before drawing the image, so transparent areas are flattened onto white in every output, PNG included.

Trying WebP or AVIF instead: ideas borrowed from video

Google's documentation describes lossy WebP as the key-frame coding of the VP8 video codec, stored in a RIFF container. VP8 is specified in RFC 6386 (November 2011). The encoder predicts each block from neighbouring pixels it has already coded and codes only the residual, the difference between the guess and the real pixels. The residual goes through a 4×4 DCT. When a macroblock is predicted as a whole, the DC terms of its 16 luma sub-blocks go through an extra Walsh–Hadamard transform. A boolean arithmetic coder writes the bits. Prediction is the main idea JPEG lacks: apart from its DC value, a JPEG block is coded on its own.

VP8 controls quantization with 7-bit indices from 0 to 127. A WebP "quality 80" is the encoder's own mapping onto those indices and other settings, unrelated to libjpeg's table scaling. In its own tests, Google reports lossy WebP files 25–34% smaller than comparable JPEGs at equivalent SSIM, and lossless WebP files about 26% smaller than PNG. Those figures depend on the test images and on how "equivalent quality" is measured.

AVIF, specified by the Alliance for Open Media, stores an AV1-coded image in a HEIF container. Transparency is stored as a separate auxiliary image. The AV1 bitstream specification gives the encoder a much larger toolbox than VP8: many block sizes, many more intra-prediction directions and larger transforms. More choices to try usually means better compression and slower encoding. Netflix tested AVIF on its own artwork and reported large savings over JPEG. The post reports results across several objective metrics, which do not always agree. Whatever the metric, "80" in JPEG, WebP and AVIF names three different settings.

In the tool, AVIF appears in Output format only when the browser can actually encode it from a canvas. The next section explains why that check matters.

What is lost on the way through the canvas

A browser-based compressor does not edit the file you give it. It decodes the image to pixels, draws them on a canvas and asks the browser to encode a new file from that bitmap. The HTML Standard sets image/png as the default type, and says "that type is also used if the given type isn't supported". In a browser without an AVIF encoder, a request for AVIF quietly returns a PNG (MDN reference). That is why the tool tests for AVIF support before offering it.

Because only the bitmap is exported, metadata from the original file is typically not carried over. That includes EXIF camera data, GPS location and an embedded ICC colour profile. For ordinary sRGB photos this makes no visible difference. For wide-gamut images, dropping the profile can shift colours on screen. Drawing an animated image onto a canvas typically captures a single frame, so an animated WebP would come out as a still.

The sizes the tool shows come from the real encoded file. They are divided by 1024 but labelled kB. Strictly, 1024 bytes is a kibibyte (KiB), as NIST explains. A file manager that counts in thousands will therefore show slightly larger numbers.

Checking the result by eye

Metrics such as PSNR and SSIM are useful for comparing encoders across large sets of images. However, they reduce perception to one number, and different metrics can rank the same encodes differently. For a single image, your own eyes on the right part of the picture are a better judge.

In the Image Compressor, Artifact zoom enlarges both previews, which makes blocking, ringing and colour bleeding visible around edges, text and gradients.

Then drag the Before / after split across a face, a logo or a line of small text to see whether the change shows where it matters.

Once quality has done all it usefully can, two other tools can help. Reducing the pixel count with a batch image resizer usually shrinks a file far more than lowering quality further. To change the format without a size or quality goal, use the image converter.

Privacy

The tool decodes and re-encodes the image in your browser through a canvas, and the page contains no upload code. As the page itself puts it: "Private by design: the image never leaves this browser."

FAQ

Why is quality 80 in WebP not the same as quality 80 in JPEG?

Neither format defines a 0–100 scale. A libjpeg-style JPEG encoder uses the number to scale its quantization tables. A WebP encoder maps it onto VP8 quantizer indices from 0 to 127 and other settings, on top of a different coding method that uses prediction. The two numbers only share a name.

Does saving a JPEG at 100% quality make it lossless?

No. In libjpeg, quality 100 sets every quantization step to 1. Coefficients are still rounded, the colour conversion is rounded, and colour may be stored at a lower resolution. The result is very close to the original, but it is still lossy.

Why does a screenshot stay small as PNG while a photo becomes huge?

PNG predicts each pixel from its neighbours and compresses repeated patterns with DEFLATE. Flat interface colours and sharp text are very predictable. Photo noise and texture are not, so the lossless file has to store almost all of that detail.

Why can the same image and setting give a different file size in another browser?

The HTML Standard only says that quality is a number from 0 to 1. Each browser uses its own encoder, with its own mapping from that number to tables or quantizers and its own colour subsampling choices, so the bytes can differ.

Is AVIF always smaller than WebP and JPEG?

Not always. Published comparisons such as Netflix's report large savings, but the size of the gain depends on the image, the encoder and the metric used to decide that two files look equally good. The reliable test is the actual file size for your own image at a quality you are happy with.

Further reading