Pixel Art Converter
Operator: Abdulla Al Fahad. How tools are built and checked
Good pixel art is a set of deliberate decisions: how big one pixel is, which handful of colours are allowed, and how to hide the banding that comes from having so few. This converter makes those decisions adjustable on a photo or drawing, and shows the result at once beside the source.
The palette can come from the picture itself or from a console's fixed set of colours, and it can leave the page as a strip of swatches or a list of hex codes for your game engine.
Key features
- Pixel size or exact grid width, with the resulting dimensions shown before converting
- K-means (2 to 64 colours), Game Boy, PICO-8, NES, CGA and custom hex palettes
- Floyd-Steinberg and Bayer 4 by 4 and 8 by 8 dithering with a strength control
- Silhouette or colour-region outlines in a colour you choose
- Nearest-neighbour export up to 8000 pixels, with transparency kept
- Palette swatch PNG and a hex list for your game engine or editor
From photo to a fixed palette
Pictures are shrunk to at most 4096 pixels on the longest side before conversion (a GIF contributes its first frame), and transparent pixels stay transparent: a pixel is kept only if the average alpha of the area behind it is at least half.
The size of the art is set in one of two ways. Pixel size is the number of source pixels that become one art pixel, so a 1200-pixel-wide photo at size 10 gives a 120-pixel-wide picture. Grid width is the number of art pixels across, and the height follows from the aspect ratio. The grid is limited to 1024 pixels across and a million pixels in total, and the size your setting gives is shown before it converts.
Palettes come from four places. K-means picks 2 to 64 colours from the picture itself. The presets are Game Boy (the four DMG greens), PICO-8 (its 16 fixed colours), NES (55 distinct colours of a common 2C02 rendering, which varies slightly between emulators) and three CGA sets, the two four-colour graphics palettes and the 16 text-mode colours. A custom palette takes up to 64 hex colours in the forms #rrggbb or #rgb, separated by spaces, commas or lines; invalid entries are listed. An Original option skips quantising and only averages blocks.
Dithering can be off, Floyd-Steinberg, or ordered Bayer at 4 by 4 or 8 by 8, with a strength slider. An outline can be drawn round the silhouette (needs transparent pixels, so cut the subject out first) or between colour regions. Brightness and contrast are applied before matching.
The export is an exact integer enlargement with smoothing turned off, at 1, 2, 4, 8, 16 or 32 times, or an automatic factor aiming near 1024 pixels. The longest side is limited to 8000 pixels. The palette leaves as a PNG swatch strip, a plain text list of hex codes, or by copying the list.
How it works
Downsampling first. The source is divided into a grid of cells and each art pixel takes the average colour of its cell, weighted by alpha. This box average is gentler on fine detail than picking one sample per cell, which would flicker between neighbouring pixels.
Then the palette. For k-means the tool takes up to 20000 sample pixels, converts them to CIELAB and picks seeds with k-means++ before iterating to the centre of each cluster, so the colours are spread by how different they look, not by their RGB numbers. For presets and custom lists the palette is fixed. Every pixel is matched to the nearest palette colour by Euclidean distance in CIELAB.
Dithering changes that matching. Floyd-Steinberg adds the previous pixels' leftover error to the next ones, scanning left to right and then right to left on alternate rows so streaks do not run diagonally. Bayer ordered dithering nudges each pixel by a threshold from a fixed matrix before matching, which gives the regular crosshatch that old consoles produced and, unlike error diffusion, is stable when the picture changes slightly.
Common use cases
- A character portrait reduced to a 32 or 64-pixel sprite for a game jam
- A photo recoloured in the four Game Boy greens for a retro wallpaper or a cartridge mock-up
- A cover image for a PICO-8 cart in its fixed 16 colours
- A palette sheet for a pixel art team, exported from a reference picture
How to use this tool
- Drop or paste a picture.
- Choose pixel size or grid width until the preview size is what you want.
- Pick a palette, then try dithering and a strength between 50 and 100 percent.
- Add an outline if the subject is cut out, and adjust brightness and contrast if the result is muddy.
- Choose the export multiple and download the PNG, and save the palette if you need the hex codes.
Example
A 1200 by 800 photo, grid width 64, PICO-8 palette, Bayer 4 by 4 dithering
source 1200 x 800
grid width 64
height round(800 x 64 / 1200) = 43
palette PICO-8, 16 coloursResult
art size 64 x 43 pixels
export at 16x 1024 x 688 px PNG
colours used up to 16, listed most used firstTips for best results
- Pick the grid width first, and let the height follow. Sprites usually work at 16, 32 or 64 pixels, backgrounds at 160 to 320.
- Four-colour palettes need dithering to show gradients at all, and Bayer 8 by 8 gives a smoother look than 4 by 4 at the cost of a finer pattern.
- Raise contrast a little before using a small palette; a flat photo otherwise lands on two or three of the colours.
- For outlines, remove the background first so the picture has real transparency to trace.
- Export at a multiple of two or more than you need and let the game engine scale it with nearest-neighbour filtering rather than enlarging the art here and filtering again.
Edge cases to watch
A picture that is already tiny gains nothing from a larger grid. The grid can never be finer than the source pixels.
K-means can return fewer colours than you asked for when the image has few distinct colours at this size.
Outlines between colour regions need a palette, and a silhouette outline needs transparent pixels. The page explains when neither applies.
The NES palette is one popular rendering. Emulators and capture cards show slightly different RGB values for the same 64 slots.
Animated GIFs are read as a single frame, and EXIF rotation is applied before the grid is calculated.
Common errors and how to fix them
- The grid would be larger than 1024 pixels across
- Raise the pixel size or lower the grid width. The limit keeps the in-browser conversion fast.
- Enter at least two valid hex colours for the custom palette
- Check that each colour is #rrggbb or #rgb and separated by spaces, commas or lines; the invalid ones are listed.
Best practices
- Keep the exported palette hex list next to the art so later pieces can reuse exactly the same colours.
Frequently asked questions
What is the best palette for a photo?
K-means with 16 or 32 colours keeps the picture's own look. Presets restyle it; they will look flat without dithering.
Does the PNG keep transparency?
Yes. Transparent areas of a PNG or WEBP stay transparent in the art and the export.
How large can the export be?
Up to 8000 pixels on the longest side. The page limits the multiple automatically when the art is large.