Image Color Palette Generator - Extract Colors from a Photo
Color palette from an image
Click anywhere on the image to read the exact color of that pixel.
Dominant colors
Click a code to copy itThe image is analysed in your browser and never sent anywhere. Transparent pixels are ignored.
How to get a color palette from an image
A photo can contain tens of thousands of slightly different colors. A palette groups them into a handful of representative colors and tells you how much of the picture each one covers — useful for building a website theme from a hero photo, matching a brand color from a logo or picking colors for a presentation.
How to use it
- 1 Choose an image or drop it on the box. The palette of the sample sunset is replaced immediately.
- 2 Set the number of colors (3 to 12) and the method. If a small accent color is missing, raise the number.
- 3 Click any HEX, RGB or HSL code to copy it, click the image for an exact pixel, or copy the whole palette as CSS variables or JSON.
k-means or median cut?
k-means starts from a few well-spread pixels and repeatedly moves each color to the average of the pixels closest to it, so the result usually matches what your eye picks out. Median cut repeatedly splits the most varied group of colors along its widest channel, cutting where the two parts come out most uniform; it is predictable and fast but tends to split large smooth gradients (a sky) into several similar shades. k-means uses a fixed seed and median cut involves no randomness at all, so the same image always gives the same palette. With either method, shades too close to tell apart are merged into one color.
Why a color you can see may be missing
The palette is weighted by area. A red button that fills 1% of a screenshot has to compete with the 60% white background, so with 5 colors it gets merged into its nearest neighbour. Raise the color count, crop the image to the part you care about, or click the button in the image to read its exact pixel. Also remember that palette colors are averages: a cluster of many similar greens may produce a green that no single pixel has.
Logos, transparency and JPEG noise
Pixels that are more than half transparent are not counted, so a PNG logo on a transparent background gives only the logo’s own colors. JPEG is different: it has no transparency and its compression adds faint in-between shades around sharp edges. If a flat brand color comes out as #1A73E9 instead of #1A73E8, that is compression, not the tool — click a solid area with the picker, and for official work use the value from the brand guidelines.
Using the palette in CSS
The CSS export gives custom properties (--palette-1, --palette-2 …) in order of share, ready to paste into :root. HSL is the handiest format for variations: keep hue and saturation and change only the lightness for hover or background tints. Before using a palette color for text, check its contrast against the background — normal-size text needs at least 4.5:1 to meet WCAG AA, and colors taken from photos are often too mid-toned to pass.