Palette Extractor

Extract one palette from several images and save it as .gpl, HEX or JSON.

Extracting a palette lists the colours a sprite uses and how many pixels each covers, so you can spot accidental near-duplicates and keep a colour budget. Drop one image or all frames of an animation; the Palette stage builds one palette for all of them (16 colours by default, 2–256), shows each colour's exact pixel count and share, sorts it, and can merge the rarest colours into their nearest survivor to meet a target. Save it as GIMP .gpl, a HEX list or JSON; nothing is uploaded.

Drop image files hereProcess many files at once
No upload · processed on this device

An exact colour list and an extracted palette are not the same thing

The Lab's extraction is a reduction. Pixels are first collected into buckets of 5 bits per channel (32 levels instead of 256), weighted by alpha, and the buckets are then split by median cut in Oklab. Two colours that differ by less than 8 levels in every channel land in the same bucket and come out as one averaged colour. That is what you want for a noisy or resized image, but not when you need the literal colours of hand-made pixel art.

For the literal list, use the Studio's Pixel workspace: Palette from the picture collects every exact colour (up to 255 plus the transparent entry), ordered by how often it is used. The Lab's counts, on the other hand, are exact for its palette: every pixel is assigned to its nearest palette colour in Oklab, with an exact-match shortcut, across every frame while the frames total under 4 megapixels.

A colour budget turns the counts into a decision. Set a target, and the rarest colours over the target are listed; merging moves each of them into its nearest surviving colour in Oklab, never into another colour that is also being removed, so the result really uses the target number of colours.

Colour budget
The maximum number of colours a sprite or a frame may use.
5-bit bucket
A group of colours whose red, green and blue agree in their top 5 bits (32 levels each).
Share
A colour's pixel count divided by all opaque pixels.
.gpl
GIMP's text palette: a "GIMP Palette" header, optional Name and Columns, then one "R G B name" line per colour.

Example: why two greens become one, and a budget from 16 to 8

Bucket arithmetic, then the budget test from the Lab's verification:

#3e8948 = (62,137,72)  → buckets 62>>3=7, 137>>3=17, 72>>3=9
#3f8a4a = (63,138,74)  → buckets 63>>3=7, 138>>3=17, 74>>3=9   same bucket
extracted: one colour, the pixel-weighted average of both
exact list (Studio, Palette from the picture): both colours, sorted by use
budget: 16 colours, target 8 → the 8 rarest are listed
merge: each goes to its nearest survivor in Oklab
export: the frames really use 8 colours, 0 outside the palette

If the two greens were drawn on purpose, count them in the Studio; if they came from resizing or compression, the merged colour is the one to keep.

Palette files the Lab writes

FileWhat it is for
palette.gplGIMP Palette text: Name:, Columns:, then R G B and the hex code as the colour name. Opens in GIMP and Aseprite.
palette.hexOne #rrggbb per line, the plain list Lospec also offers.
palette.jsonname, colors as #rrggbb, rgb as [r,g,b] triples, count and source.

Check the extracted palette

  • Compare the colour count with the Studio's exact list: a big difference means the image was noisy or resized.
  • Sort by frequency: colours with a share near 0 % are candidates for the budget merge or stray-pixel cleanup.
  • Import the exported file again (paste or file): it must give back the same number of colours.
  • After a merge, export the frames and count their colours in another tool: the count must equal the target.

Troubleshooting

SymptomLikely causeHow to checkFix
Two colours that should stay separate were mergedThey fall into the same 5-bit bucket (less than 8 levels apart per channel)Compare with Palette from the picture in the Studio's Pixel workspaceUse the Studio's exact list, or make the colours more distinct
Asked for 32 colours, got fewerThe image has fewer distinct buckets than requested; a box cannot be split below one colourThe palette shows fewer swatches than the countNothing is wrong: the image uses that many colours
A palette file will not importThe Lab reads GIMP .gpl, HEX lists and JSON only; a JASC .pal, a Paint.net .txt with AARRGGBB values, or a .gpl with Aseprite's "Channels: RGBA" line is rejectedThe error names the line it could not readDownload the .gpl or .hex version, or load the file in the Studio's Pixel workspace, which reads more formats
Counts cover only the visible frameAll frames together exceed 4 megapixelsThe panel says so next to the countsLoad fewer frames for exact totals

Other ways to do it

OptionWhen it is the better choice
Studio Pixel workspace: Palette from the pictureYou need the literal colours of hand-drawn art, or palette formats beyond .gpl/.hex/.json (.pal, .ase, .act). See the palette editor.
Starting from a published paletteYou want the sprite to follow a known palette instead of its own: Lospec palettes.
Checking scale and blur before extractingThe image may be an upscale: counts from a blurred upscale are meaningless until it is snapped to 1×; see the pixel-perfect checker.

What this page does not cover

  • Extraction merges colours closer than 8 levels per channel; it is not an exact inventory.
  • Reads and writes .gpl, HEX and JSON only.
  • Exact counts stop at 4 megapixels of total frame area.

Versions and sources

Nerulio: docs/PIXEL-LAB.md (Chromium; the budget merge from 16 to 8 colours was re-counted in the exported PNGs; .gpl, .hex and JSON round trips 16 → 16 colours). The bucket arithmetic follows src/pixel-engine.js. File layouts follow the GIMP specification and Lospec's own downloads.

Official documentation used

Palette Extractor

Extract one palette from several images and save it as .gpl, HEX or JSON.

How it works

  1. Add images
  2. Adjust settings and review the result
  3. Download a new file

Supported formats

PNG / JPG / WebP / AVIF / HEIC → PNG + JSON (ZIP) — Input decoding depends on browser support and optional engines.

What this tool does

Pull 4, 8, 16, 32 or 64 colours from several images at once and save .gpl, HEX or JSON.

Implementation and verified quality

advanced · shared alpha-weighted histogram / Oklab median cut + Lloyd / .gpl, HEX and JSON round trip. Quality qualification is in progress. Pro/Flagship quality has not been established.

Before you export

Colours are counted in 5-bit-per-channel buckets, so a colour used on one or two pixels can merge into a neighbour.

Frequently asked questions

What are this tool’s limitations?

Colours are counted in 5-bit-per-channel buckets, so a colour used on one or two pixels can merge into a neighbour.

Are my files uploaded?

This tool processes the files you open on your device without uploading them. Images you explicitly attach to community posts are uploaded separately. Optional engines and models are downloaded from third parties; those requests expose connection information such as your IP address.

Will my work be saved automatically?

No. Images and editing state stay in this tab; media output can use local temporary storage. Changing language preserves your work; reloading, closing the tab, or following a link to another page can clear it.