All articles
•3 min read

Spending a pixel budget

Every image generation hands you a fixed canvas, usually around one megapixel. That's your pixel budget. For a photo it's plenty. For pixel art, where every art pixel needs several real pixels to come out crisp, it disappears fast. A little math goes a long way toward clean sprites instead of muddy ones.

What a pixel budget is

A 1024×1024 output has 1,048,576 pixels. That number is fixed per generation, whatever you ask for. The real question is how many of those pixels it takes to draw one pixel of your art.

If each art pixel is drawn as an 8×8 block, the canvas holds 128×128 art pixels, or 16,384 in total. That's your actual budget. You can spend it on one 128×128 sprite, four 64×64 sprites, or sixteen 32×32 sprites. Same canvas, same cost.

The formula is simple: art pixels you can afford = canvas pixels ÷ block size².

Why one art pixel needs many real pixels

Image models don't place individual pixels. Latent diffusion models, for example, work in a compressed space that's typically 8 times smaller on each side, and a decoder fills in the fine detail afterwards. A 1024 image starts out as a grid of roughly 128×128 latents.

That's why very small blocks tend to blur together. There isn't room in the representation for a hard edge every two or three pixels, so edges between colors come out as short gradients instead of clean steps.

Bigger blocks make that soft edge a smaller share of each block. At 8×8, the center of every block is solid color even when the borders are fuzzy, and that center is what you can rely on.

Density versus fidelity

Every pixel budget forces the same trade. Smaller blocks fit more art but read less reliably. Bigger blocks read cleanly but fit less. As a rough guide:

  • 2 to 3 pixels per art pixel: lots of room, but colors bleed and lines wobble.
  • About 4 pixels: workable for simple, high-contrast shapes.
  • About 8 pixels: crisp, recoverable blocks, at a quarter of the art you'd fit at 4.

The goal is to push the model as far as it can reliably go, and no further. The sweet spot varies by model, so test it: generate the same subject at a few block sizes and note where edges start to break down.

What overspending looks like

Say you want sixteen detailed 128×128 sprites and ask for all of them on one 1024 sheet. Each sprite gets a 256×256 cell, which leaves just 2 real pixels per art pixel. That's 262,144 art pixels squeezed into a canvas that comfortably holds 16,384 at 8 pixels each, sixteen times over budget.

The result is a blurry mess. Outlines melt into the fill, small highlights vanish, neighboring colors smear together, and the grid is impossible to recover. No amount of post-processing fixes it, because the detail was never there to begin with.

The fix isn't a better prompt. Spend less per call: fewer sprites per sheet, or smaller sprites. Four 128×128 sprites at 4 pixels each, or one at 8, will beat sixteen at 2 every time.

Make the math divide evenly

Choose sizes that divide the canvas cleanly. 1024 splits evenly by 2, 4, 8, 16 and so on, so power-of-two block and sprite sizes keep every art pixel on a whole number of real pixels. A block size of 10.24 means some art pixels get 10 real pixels and others get 11, and the grid drifts across the image.

When several assets share one canvas, give them clear cells. Models like to let details wander into the neighbors.

Let post-processing do the precise work

The model's job is good decisions about shape, color and style. Exact pixels are a job for code, and code is cheap and predictable.

  • Downsample by majority, not average. Take the most common color in each block. Averaging turns every soft edge into a new in-between color.
  • Trust the center. Sample the middle of each block, where color is stable, and ignore the borders.
  • Snap to a palette. Pixel art lives on a limited set of colors, so merge near-duplicates into one value.
  • Scale up with nearest neighbor at whole-number factors only: 2×, 3×, 4×. Anything else smears pixels or makes them uneven.

Spending it well

  • Know your budget: canvas pixels divided by block size squared.
  • Spend it where the model is reliable, not where it looks cheapest.
  • Fill the canvas. One small sprite on a big canvas wastes most of what you paid for.
  • Let the model draw, and let code measure, snap and scale.