AI image generators usually hand you a large square or landscape image, often 1024 or 2048 pixels wide. Before it goes into a blog post, a thumbnail or a social card you will shrink it, and that is where a lot of images lose their crispness: fine lines shimmer, small text turns to mush and edges get halos. The resampling filter you choose makes most of the difference. Here is a quick, practical comparison using Pillow.

The filters Pillow offers

Filter Speed Typical result when shrinking
NEAREST fastest jagged edges, aliasing
BILINEAR fast soft, slightly blurry
BICUBIC medium sharper, mild ringing
LANCZOS slowest sharpest, can halo on hard edges
BOX fast good for large integer reductions
HAMMING fast between bilinear and bicubic

A comparison script

from PIL import Image src = Image.open('generated.png').convert('RGB') target = (600, 600) filters = { 'nearest': Image.Resampling.NEAREST, 'bilinear': Image.Resampling.BILINEAR, 'bicubic': Image.Resampling.BICUBIC, 'lanczos': Image.Resampling.LANCZOS, 'box': Image.Resampling.BOX, } for name, f in filters.items(): src.resize(target, resample=f).save(f'out_{name}.png') 

Open the outputs at 100% zoom side by side and look at three areas: any text or lettering, thin lines such as hair or wires, and high-contrast edges.

What I usually see

  • LANCZOS gives the crispest result for illustrations and photos. On flat graphics with hard black-on-white edges it can add a faint halo.
  • BICUBIC is a safe default when you are not sure; slightly softer than Lanczos, fewer halos.
  • BOX is surprisingly good when you shrink by an exact factor, such as 2048 to 1024 or 1024 to 512.
  • NEAREST is only useful for pixel art.

Shrink in steps for very large reductions

Going from 2048 to 300 pixels in one jump can alias fine textures. Two steps, first with BOX to half size and then LANCZOS to the final size, often looks cleaner:

half = src.reduce(2) # fast integer reduction final = half.resize((300, 300), Image.Resampling.LANCZOS) 

Image.reduce() is a fast box filter for integer factors.

A light sharpen after resizing

A small unsharp mask restores some edge contrast lost in downscaling:

from PIL import ImageFilter final = final.filter(ImageFilter.UnsharpMask(radius=1, percent=60, threshold=2)) 

Keep it subtle; over-sharpened AI images look crunchy very quickly.

Order of operations matters

If you are also cleaning up an image, for example removing a visible corner mark from your own generated image, do that at full resolution first and resize last. Edits blend better with more pixels to work with. The processing order used by one in-browser editor is described at https://ggeminiwatermarkremover.com/how-it-works/ and follows the same idea: edit at source size, export, then scale.

Save in the right format

After all that care, do not throw the detail away on export. Use PNG or high-quality WebP for images with text or flat colour, and JPEG at quality 85 or above for photographic scenes.