Guide · Cleaning

Reducing JPEG and WebP artifacts without changing the size

What compression artifacts are, what the AI Clean model measured on 100 damaged patches, and where same-size cleaning stops being useful.

Compression artifacts are the blocky patches, ragged edges and speckle that appear when a picture has been saved at low quality or re-saved many times. AI Clean tries to reduce them while keeping the image's width and height unchanged. This guide explains what it does, what its measurements show and where it stops.

What the artifacts are

JPEG divides a picture into blocks of 8 by 8 pixels and discards fine detail inside each block. At low quality the block edges become visible, and thin lines pick up a ringing of speckle around them.

WebP uses a different scheme, and its artifacts often look smoother and blurrier. Camera noise is a separate problem. It is random grain, and it is strongest in dim light.

None of these can be undone exactly, because the discarded information is gone. A model can only estimate a cleaner version.

What AI Clean does

AI Clean is a compact network with 232,963 parameters, stored in a file of 488,794 bytes. It takes your image and returns one with exactly the same width and height.

It runs in your browser, on WebGPU where the device allows it and otherwise on the CPU through WebAssembly. Your image is not sent to a server.

Because the size does not change, this is a different job from upscaling. If you also need a larger picture, read the guide on choosing 2x or 4x.

What the measurements show

Before the model shipped it was tested on a frozen internal experiment. The test used 100 image patches of 256 pixels. They were damaged separately by JPEG compression, by WebP compression and by added noise. The score is PSNR, a standard measure of how close an image is to a reference. Higher means closer.

  • JPEG damage: from 23.80 dB before cleaning to 24.51 dB after, a gain of 0.71 dB.
  • WebP damage: from 24.56 dB to 25.22 dB, a gain of 0.66 dB.
  • Added noise: from 27.76 dB to 29.10 dB, a gain of 1.35 dB.
  • Patches that were already clean came back at 45.7 dB. The model had to stay above 45 dB.

Averaged over the three damaged groups, the output sat 0.91 dB closer to the original than the damaged input did. That is a small, measurable improvement and not a transformation.

Two limits come with the numbers. The damage was synthetic, produced by the test itself, so real photographs may behave differently. And a better score does not mean the original detail came back. It means the output sits closer to the original on that one score.

Where AI Clean stops

AI Clean has size ceilings: 4,000,000 pixels when WebGPU runs it and 50,176 pixels when it falls back to the CPU. A 12-megapixel phone photo is above both. An image outside the ceiling is refused instead of being processed slowly.

The control may also be absent. It appears only after the browser reproduces a recorded reference output on the current device.

The saved file is encoded again. PNG input is saved as PNG. WebP input is saved as WebP at quality 0.92. JPEG and AVIF input are saved as JPEG at quality 0.92, which is itself a lossy save.

How to read the comparison

Drag the handle across a flat area first, such as sky or a plain wall, where blocks and speckle show most. Then drag it across a sharp edge, such as lettering or a fence.

A good result calms the flat area without softening the edge. If edges lose their crispness, the cleaning is costing more than it gives, and the original is the better file.

Getting a better result

  • Start from the original export, not from a screenshot or a copy that was re-saved by a messaging app.
  • Avoid saving the same JPEG again and again. Repeated lossy saves tend to discard more.
  • Compare at full size with the slider. Look at flat areas and at edges.
  • If an area looks synthetic, incorrect or over-sharp, keep the original instead.

When not to use it

Do not use a cleaned image as evidence. Fine text and regular patterns are also risky, because a model can smooth them into something that only looks tidy. A result of this kind should never be used for identification, or for medical, legal or forensic decisions.

Related pages