Image Color Extractor - Extract Dominant Colors from Any Photo
Image Tools
Extract dominant image colors and copy the palette as CSS variables or JSON. View HEX, RGB, and HSL values with processing entirely in your browser.
How to use this tool
- Upload an image. Drag & drop or click to upload any image file.
- Choose palette size. Select 4, 6, 8, or 10 colors before or after upload; the palette recalculates when you change the size.
- Copy or export color codes. Click a swatch to copy its HEX value, or copy the full palette as CSS variables or JSON.
What Is the Image Color Extractor?
The Image Color Extractor analyzes an image and returns a palette of its most prominent colors. Upload a browser-supported image to see each color as HEX, RGB, and HSL, along with its approximate share of sampled pixels and nearest match from a small set of CSS color names. You can copy individual HEX values or export the full palette as CSS custom properties or structured JSON.
How Does It Work?
The tool decodes your image in the browser, draws a downsampled version onto an HTML canvas, and samples every fourth opaque pixel. The longest image dimension is reduced to at most 200 pixels to keep analysis quick. A median-cut algorithm repeatedly splits sampled pixels along their widest RGB channel, then averages each group to create a swatch. Groups with more sampled pixels appear first.
Choose 4, 6, 8, or 10 colors before uploading or change the size after extraction; the palette recalculates when the selection changes. The percentage values are approximate because they describe the sampled, downsampled image rather than every original pixel. Transparent pixels are skipped, and a browser must be able to decode the image format.
Median-cut and color clustering
Color extraction is fundamentally a clustering problem: group millions of similar pixel colors into a small number of representative swatches. Median-cut is a fast, tree-based approach: each split separates a bucket of colors, and averaging the resulting buckets gives a compact summary of the image. Choosing more colors preserves more variation but may include near-duplicate shades; fewer colors emphasizes only the broadest color groups.
Design applications
- Building a brand palette from a company logo or product photo
- Copying CSS custom properties or JSON tokens into a design system
- Creating e-commerce color swatches for product listings
- Finding complementary colors for UI design based on a hero image
- Generating data visualization palettes that match existing photography
Color harmony from natural photos
Colors extracted from natural photographs often form harmonious palettes by default. This happens because natural scenes are lit by a single light source (the sun), giving all colors a consistent color temperature. Sunsets, forests, and ocean photos in particular yield ready-to-use complementary and analogous palettes - useful for UI design inspiration without starting from scratch.
Use Cases
Extract a brand color palette from a logo, find the dominant hues in a photograph for a design system, copy CSS custom properties or JSON tokens into a project, or simply explore what colors make up a striking image. For exact pixel sampling, use the Image Color Picker; this tool summarizes the overall image rather than locating one precise pixel.
Frequently asked questions
How does the color extractor work?
The tool draws your image onto an HTML canvas, samples the pixels, and runs a median-cut algorithm to cluster similar colors and find the most dominant ones.
Is my image uploaded anywhere?
No. All processing happens in your browser using the Canvas API. Your image never leaves your device.
What image formats are supported?
The file picker accepts image formats, and the browser must be able to decode the selected file. JPEG, PNG, WebP, and GIF are commonly supported; support for formats such as AVIF or BMP can vary by browser.
How can I export the extracted colors?
Copy an individual HEX value by selecting its swatch. After extracting a palette, use Copy CSS variables for a :root block with HEX and RGB custom properties, or Copy JSON for structured HEX, RGB, HSL, percentage, and approximate color-name data.
Related tools
- Palette GeneratorTurn extracted dominant colors into complementary and analogous harmony options.
- Image Color PickerInspect one precise pixel when the dominant palette misses a detail.
- Contrast CheckerCheck candidate text and background pairs from the extracted palette.
- Duotone GeneratorReuse two extracted colors as a stylized photographic treatment.
- Color ConverterConvert extracted HEX values to RGB, HSL, HSV, or CMYK for a design workflow.
- Color BlindnessPreview how palette colors appear under common color-vision deficiencies.
- Camera Color PickerSample a matching real-world color from your camera while adjusting a palette.