# How to remove AI artifacts from an image

Source: https://passreal.com/how-to/remove-ai-artifacts

Artifacts fall into two groups. Semantic errors such as extra fingers, garbled text or melted objects need inpainting or a new generation. Signal artifacts such as upsampling grids, over-smooth texture, halos and colour banding can be reduced after the fact with frequency filtering, grain and careful re-encoding. Sort yours first, because the fix for one does nothing for the other.

## Two kinds of artifact, two kinds of fix

The word artifact covers very different problems, and most frustration comes
from using the wrong tool on the wrong one. A sharpening filter will not give a
hand five fingers. A re-generation will not give a smooth gradient the fine
texture of a camera file.

Start by separating what you see into two piles.

Semantic artifacts are errors of meaning. A seventh tooth, a watch with two
crowns, text that almost spells a word, a chair leg that merges into a shadow.
They exist because the model produced a plausible local patch without checking
the whole object.

Signal artifacts are errors of texture and statistics. Skin that looks waxed,
an even grain-free sky, a faint regular grid visible in a Fourier transform,
bright halos around edges, banding in smooth gradients. They are properties of
the pixels rather than of the scene.

## Fixing semantic errors

There are only two reliable routes.

- Inpaint. Mask the faulty region, regenerate it at a low denoising strength so
  surrounding pixels guide the result, and try several seeds. Keep the mask
  tight; a large mask invites new errors.
- Regenerate. If the composition is wrong in several places, a new seed is
  faster than five repairs.

Do this first. Every later step changes pixel values, and repairing after
filtering leaves visible seams between treated and untreated regions.

## Reducing signal artifacts

For a regular grid, look at the spectrum. A two-dimensional FFT shows periodic
upsampling residue as isolated peaks away from the centre. A mild low-pass that
attenuates the highest frequencies reduces them without softening the image
to a visible degree. Go gradually and compare, because the correct cutoff
depends on the image.

For over-smooth texture, the answer is not sharpening, which only exaggerates
edges. It is a small amount of grain added once, at the full size of the final
file, before compression. Noise added early and then resized becomes mush.

For halos, lower the sharpening you applied upstream, or in a generator reduce
the guidance value. For banding, a hint of noise dithering hides the steps in a
gradient.

## Order matters

A dependable order is: repair meaning, filter the spectrum, add grain, then
export once. Exporting twice compounds compression artifacts, and compression
is itself a source of blocky texture.

## What about metadata?

Artifacts in the pixels are not the only thing that identifies a generated
image. Files often carry C2PA manifests, IPTC digital source type fields, XMP
blocks or PNG text chunks that state the origin. Cleaning the pixels while
leaving those in place solves half the problem.

## The automatic version

PassReal bundles the signal-level steps: it strips C2PA, IPTC, XMP and PNG text
chunks, applies a sensor model with grain and radial chromatic aberration,
low-passes the spectrum, and writes a JPEG with EXIF from a real camera. It
does not touch semantic errors, so repair those first.

It also does not remove SynthID or other pixel-level watermarks. If a generator
embeds one, this tool will leave it in place.

## When to start over

Some images are not worth repairing. If the hands, the text and the main object are all wrong, regenerating costs less than repairing and gives a cleaner result. If the problem is only a texture that looks synthetic, repair is cheaper than starting again. A useful rule is to count the semantic errors: one or two get an inpaint, three or more get a new seed. Keep the prompt and the seed from the good version so you can return to it.

## Judging the result

Open the before and after at the same zoom and look at three places: the
smoothest area, the highest-contrast edge, and the most detailed texture. If
the smooth area now has fine grain, the edge has no halo and the texture is
intact, the signal artifacts are handled.

Process three images free at PassReal to see the difference on your own files.

## Questions

### Can software fix a hand with six fingers?

Not by filtering. The shape itself is wrong, so you need inpainting on that region or a new generation. PassReal does not repair anatomy.

### What causes the faint grid pattern in some images?

Upsampling layers in the generator work on a fixed grid, which leaves a periodic component in the spectrum. A frequency-domain low-pass reduces it.

### Will removing artifacts lower image quality?

A little, since filtering and re-encoding change pixels. The cost is reported as PSNR and SSIM on the comparison sheet, so you can judge it.

### Does it remove a watermark?

It removes declared provenance data such as C2PA and IPTC fields. It does not remove SynthID or any visible or pixel-level watermark.

### Is upscaling a good way to clean an image?

Often the opposite. Many upscalers smooth texture and add their own regular patterns, so check the result at full size before you keep it.

Try it: https://passreal.com/app (three images free)
