How to Choose Max Colors (Without Guessing)
A color-budget guide for pixel conversion: pick maxColors based on output purpose, not trial-and-error alone.
Grid, file size, and color controls
For icons, start with a 16×16 or 32×32 Target grid and the same file size. The logical grid is independent of source resolution. File sizes can be whole-number multiples of that grid; Preview zoom changes only the display. Check the 1× actual-size preview on light and dark backgrounds.
Keep full image adds transparent padding. Center crop keeps the centered square and shows the removed edges. Free pixel multiplier depends on source size: each grid dimension is the source dimension divided by the multiplier, rounded up. Multiplier numbers in older examples are starting points for a particular source, not universal icon settings.
Nearest, Floyd-Steinberg, and Ordered use the selected fixed palette. maxColors only controls Median cut, which creates adaptive colors from the image and ignores the fixed palette. PNG preserves exact colors and alpha. JPEG uses white behind transparency; JPEG/WebP compression can change colors.
Color budget by use case
maxColors applies only to Median cut. Nearest, Floyd-Steinberg and Ordered use all available colors in the selected fixed palette; the limit does not reduce that palette.
- Favicon/icon: 4-12 colors
- Avatar/PFP: 16-32 colors
- Photo-style poster: 32-64 colors
- Sprite animation: 8-24 colors
How to diagnose wrong color budgets
Visual symptoms tell you whether to increase or decrease maxColors.
- Flat and lifeless gradients: increase maxColors
- Muddy noisy regions: decrease maxColors
- Brand colors drift: use fixed palette before increasing color count
Decision process in two passes
Pass 1 sets shape readability; pass 2 restores enough detail. This avoids endless random tweaking.
- Pass 1: choose pixel size first, then set low color count
- Pass 2: raise maxColors in small steps (+4 or +8) until details recover
Advertisement