Image Color Palette Extractor — Free Color Picker Tool

Free Color Palette Generator from Image — Extract Colors Online

Color Palette Generator

Upload any image and extract a beautiful color palette. Get hex codes, RGB values, and WCAG contrast accessibility scores. All processing happens in your browser — your images never leave your device.

🖼
Drop an image here or click to upload
Supports JPG, PNG, GIF, WebP · Max 10MB · Your image stays private
Uploaded image preview

⚡ Contrast Accessibility (WCAG 2.1)

Frequently Asked Questions

Yes, completely free. No signup required, no usage limits, and no watermarks. Upload as many images as you want and extract unlimited color palettes.

No. All image processing happens locally in your browser using the HTML5 Canvas API. Your images are never uploaded to any server, never stored, and never seen by anyone else. This makes it safe for proprietary or confidential images.

We provide HEX codes (e.g., #4f46e5), RGB values (e.g., rgb(79, 70, 229)), and HSL values for each extracted color. You can copy individual colors by clicking on them, or export the entire palette as CSS variables or a PNG image.

We calculate WCAG 2.1 contrast ratios between each color and white/black backgrounds. AA level requires a ratio of 4.5:1 for normal text, while AAA requires 7:1. This helps ensure your color choices are accessible to users with visual impairments.

We use a quantized color frequency analysis with perceptual distance clustering. The algorithm analyzes every pixel in your image, groups similar colors together, and picks the most dominant representatives while ensuring sufficient visual variety in the final palette.


Image Color Palette Extractor

Upload an image to extract its dominant color scheme and hex codes instantly

📁 Click to Upload Image

Supports PNG, JPG, JPEG, and WebP images. All extraction is done locally in your browser.

Preview Image

// Sample pixels on a grid for (let i = 0; i < imgData.length; i += 16) { // step by 4 pixels (16 array slots) const r = imgData[i]; const g = imgData[i+1]; const b = imgData[i+2]; const a = imgData[i+3]; // Ignore highly transparent or almost white/black background pixels if (a < 200) continue; // Group similar colors together by rounding RGB values (color quantization) const factor = 16; const qr = Math.round(r / factor) * factor; const qg = Math.round(g / factor) * factor; const qb = Math.round(b / factor) * factor; const hex = rgbToHex(qr, qg, qb); colors[hex] = (colors[hex] || 0) + 1; } // Sort colors by frequency let sorted = Object.keys(colors).sort((a, b) => colors[b] - colors[a]);

// Filter out colors that are too similar to each other to get a diverse palette const finalPalette = []; for (let hex of sorted) { let tooSimilar = false; for (let finalHex of finalPalette) { if (colorDistance(hex, finalHex) < 60) { // threshold for similarity tooSimilar = true; break; } } if (!tooSimilar) { finalPalette.push(hex); } if (finalPalette.length >= 5) break; }

// Fallback to top sorted if not enough diverse colors while (finalPalette.length < 5 && sorted.length > finalPalette.length) { const next = sorted[finalPalette.length]; if (!finalPalette.includes(next)) finalPalette.push(next); }

renderPalette(finalPalette); }

function rgbToHex(r, g, b) { const toHex = c => { const hex = Math.max(0, Math.min(255, c)).toString(16); return hex.length === 1 ? '0' + hex : hex; }; return '#' + toHex(r) + toHex(g) + toHex(b); }

function hexToRgb(hex) { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; }

function colorDistance(hex1, hex2) { const rgb1 = hexToRgb(hex1); const rgb2 = hexToRgb(hex2); if (!rgb1 || !rgb2) return 0;

// Simple Euclidean distance in RGB space return Math.sqrt( Math.pow(rgb1.r - rgb2.r, 2) + Math.pow(rgb1.g - rgb2.g, 2) + Math.pow(rgb1.b - rgb2.b, 2) ); }

function renderPalette(hexList) { const container = document.getElementById('cpgPalette'); container.innerHTML = '';

hexList.forEach((hex, index) => { const card = document.createElement('div'); card.className = 'cpg-color-card'; card.innerHTML = `

${hex.toUpperCase()}

`; container.appendChild(card); });

container.classList.add('show'); }

function copyColorCode(hex) { navigator.clipboard.writeText(hex); alert('Copied hex code: ' + hex.toUpperCase()); }

function generateRandomPalette() { const list = []; for (let i = 0; i < 5; i++) { const r = Math.floor(Math.random() * 256); const g = Math.floor(Math.random() * 256); const b = Math.floor(Math.random() * 256); list.push(rgbToHex(r, g, b)); } document.getElementById('cpgPreviewBox').classList.remove('show'); renderPalette(list); } // Initial random palette generateRandomPalette();

How to Extract Color Palettes from Images

Our free online color palette extractor scans images in real-time to pick out the dominant color schemes. Follow these simple steps:

  1. Upload your image: Drag and drop or click to upload any PNG, JPG, JPEG, or WebP image.
  2. Automatic extraction: The tool uses pixel quantization algorithms in JavaScript to extract the 5 most dominant and visually diverse colors.
  3. Copy hex codes: Click the "Copy" button under any color card to save its Hex color value to your clipboard.
  4. Random generator fallback: If you just need inspiration, click "Random Palette" to generate a random 5-color scheme.

The Science of Color Quantization

Color extraction works through a process called **color quantization**, which reduces the thousands of unique colors in a digital image down to a small, representative palette. Common algorithms include:

  • Median Cut Algorithm: Splits the color space along the longest RGB axis, recursively grouping pixels into boxes until the target palette count is reached.
  • K-Means Clustering: Groups pixels into clusters based on Euclidean distance in RGB color space, iteratively recalculating centroids until the most dominant color groups emerge.

Our client-side extractor samples pixels across a balanced grid and filters out colors that are too close in distance, ensuring your generated palette contains a beautiful, contrast-rich range of shades instead of overlapping tones.

Best Practices for Color Harmonization in UI Design

When designing websites or digital assets, follow the standard **60-30-10 rule** of color distribution:

  • 60% Dominant (Base): Use a neutral background or primary color for 60% of the canvas (usually whites, greys, or dark modes).
  • 30% Secondary (Structure): Use a secondary color for 30% of your components (sidebars, text color, card backgrounds).
  • 10% Accent (Call to Action): Use your brightest, most contrast-rich palette color for 10% of the interface (buttons, links, active states) to draw user attention.

Frequently Asked Questions

Is this color palette extractor free?

Yes. The Toolfix Color Palette Extractor is 100% free with no registrations or limits.

Are my uploaded images secure?

Yes. The entire processing is client-side. The image is rendered onto an offline HTML5 canvas element inside your browser. No files are uploaded to our web servers, protecting your privacy.

What color formats are supported?

Our tool outputs standard Hex codes (e.g. #667EEA) which are compatible with CSS styling, Figma, Adobe Photoshop, and Canva.

Why are background colors ignored?

Our algorithm filters out pure whites, absolute blacks, and highly transparent pixels. This prevents the generator from filling your palette with dominant background colors, focusing instead on the actual subjects in your photos.