Outils · Couleur · Générer une palette de couleurs · Guides · How to Pull a Color Palette Straight Out of a Photo

How to Pull a Color Palette Straight Out of a Photo

6 min de lecture

The fastest way to a palette that already looks intentional is to stop generating one from scratch and pull it out of something that already has good color in it - a product photo, a brand mood board, a photo of the physical space a design needs to match. If the source photo's colors already work together in real life, a palette extracted from it inherits that.

Upload the image

On the color palette generator, the "Extract a palette from an image" drop zone sits above the generated palette bar - it's optional, not a separate mode you have to switch into. Drop or choose a JPG, PNG, WebP, GIF, or BMP file up to 25 MB. Nothing is uploaded anywhere; the image is read and sampled entirely in your browser, and the file never leaves your device.

What actually happens to the image

The tool doesn't just grab five random pixels. It downscales the image to a small working size first (200px on the long edge is plenty for finding dominant colors and keeps the sampling cheap), then builds a histogram of every pixel's color, bucketing similar shades together so a photo with millions of individual pixel values collapses into a manageable set of color groups. It picks the most common groups, spread apart enough from each other that you don't end up with five near-identical shades of the same beige, and converts each one to a hex code. Any pixel that's mostly transparent is skipped, so a PNG with a transparent background doesn't get counted as "the color transparent."

This means the result reflects what's actually dominant in the photo, not just whatever's in the center or the corners - a product photo with a white backdrop and a colorful product will correctly surface the product's colors as well as the backdrop, weighted by how much of the frame each one occupies.

From photo to palette

The path from an uploaded photo to five extracted swatches The photo is downscaled for cheap sampling, its pixels are grouped by similarity into a histogram, the most common and distinct groups are chosen, and each becomes a hex-coded swatch you can still lock and reroll like any generated palette. photo your device only downscale + group similar pixels 5 swatches, still lockable
The photo is downscaled, its pixels grouped into a histogram, and the most common distinct groups become your five swatches - which you can then lock and reroll exactly like a generated palette.

The extracted colors replace the unlocked swatches, not the whole palette

If you've already locked a swatch or two from generating palettes before uploading an image, extraction only replaces the unlocked ones - the same locking behavior that works for rerolling applies here too. This is genuinely useful if you already have one fixed brand color and want the rest of the palette to pull from a reference photo without losing that anchor color.

Once the swatches populate, they behave like any generated set: click a swatch to copy its hex code, use the lock icon to keep a color you like while you try a different photo or reroll the rest, and drag or use the move buttons to reorder them. The palette's shareable URL updates too, so you can send someone a link to the exact result without re-uploading anything.

What kind of photo actually produces a good palette

Not every photo is a good source. A photo with a handful of clearly distinct color regions - a product against a plain backdrop, a sunset with a few clear bands of color, a room with a few dominant surfaces - produces the cleanest results, because there really are five (or fewer) genuinely dominant colors for the histogram to find. A busy, textured photo with hundreds of similar mid-tones and no strong dominant regions - a forest canopy, a crowd of people in similar clothing, a close-up of fabric texture - tends to produce a palette that's technically correct (these are the most common colors) but less useful, because the colors it finds are all close variations of the same muddy green or gray rather than a spread you'd actually want to build a design around.

If a first attempt comes back feeling flat or too similar across all five swatches, that's usually a sign the source photo doesn't have enough color variety, not that the extraction did something wrong. Try a different crop or a different photo with more visually distinct regions rather than expecting the tool to invent contrast that isn't in the source image.

Format issues to know about

A file over 25 MB is rejected with a plain message rather than silently failing. If the file isn't a JPG, PNG, WebP, GIF, or BMP - by MIME type or extension - it's rejected the same way. A fully transparent image (nothing but empty pixels) can't produce a palette, since there's no real color to sample, and you'll get a clear error rather than five identical swatches. Beyond that, any image that decodes normally in a browser works, including a photo taken straight off a phone.

Trying more than one source photo

Because extraction only replaces unlocked swatches, it's realistic to work through several candidate photos in sequence rather than committing to the first result: upload one, look at what comes out, lock the one or two colors that read well, then upload a second photo and let it fill in the rest. This gets you a palette that's genuinely informed by more than one reference rather than fully dependent on a single image's color balance - useful when you have several product shots or brand reference images and no single one captures everything you want.

Export what you get

Once you're happy with the extracted set, export it as CSS custom properties, JSON, SVG, or a PNG strip of the swatches, using the export controls next to the palette bar - the same export path a fully generated palette uses. There's no separate "extracted palette" format; it's the same palette pipeline the whole tool runs on.

If you'd rather start from scratch instead of a photo, the previous guide covers why generating and locking beats picking colors one at a time. And before you ship whatever palette you land on, it's worth running it through a quick contrast check - a palette can look great and still be unreadable once text goes on top of it.

Essayer Générer une palette de couleurs gratuitement Générer une palette de couleurs