Color Palette From Image: Extract Brand Colors in Seconds

Get a color palette from any image for free. Extract brand colors from a logo or product photo with HEX, RGB, HSL, contrast ratios and CSS or Tailwind export.

Upload a logo or product photo to pull out its dominant colors, see ad-ready color roles with contrast ratios, and export the palette as CSS, Tailwind, JSON or PNG.

How to use the Color Palette Extractor

  1. Upload your image. Drop a logo, product photo or existing ad into the upload area, or start with the built-in sample image.
  2. Tune the palette. Choose how many colors to extract (5 to 10) and turn on Ignore white and black background for logos on plain backgrounds.
  3. Pick exact colors. Click anywhere on the image to sample that pixel and add it to the palette. Remove any swatch you don't need.
  4. Check the ad roles. Review the suggested background, CTA, accent and text colors and their contrast ratios in the live ad preview.
  5. Export. Copy the palette as CSS variables, a Tailwind config or JSON, or download a PNG palette image to share with your team.

How to get a color palette from an image

This tool builds a color palette from an image by grouping similar pixels together and reporting the average color of each group. The image is first scaled down to about 160 pixels on its longest side, which keeps the analysis fast without changing which colors dominate. Fully or mostly transparent pixels are skipped, so a PNG logo on a transparent background gives you the logo colors rather than an empty white or black swatch.

The grouping uses k-means clustering: the tool picks starting colors spread across the image, assigns every pixel to its nearest color, recalculates each group's average and repeats until the groups stop changing. Color distance is weighted toward green and blue differences, which roughly matches how people perceive color, so two blues that look different stay separate. The same image always returns the same palette, and each swatch shows the share of pixels it represents.

  • Use 5 or 6 colors for a logo or a flat illustration; use 8 to 10 for busy product photos.
  • Turn on Ignore white and black background when a logo sits on a plain white or black canvas, so the background doesn't take a swatch.
  • Shares are calculated from the pixels that were counted, so they change when background filtering is on.

Extract brand colors from a logo

To extract brand colors from a logo, upload the cleanest version you have: an SVG or a high-resolution PNG is better than a screenshot or a compressed JPG. JPG compression and anti-aliased edges create in-between shades, which can show up as extra muddy swatches. If that happens, lower the number of colors or remove the stray swatch.

Extracted colors are averages, so they can be a few values off the official brand color. When you need an exact match, click a solid area of the logo with the eyedropper to sample that pixel directly, then add it to the palette. If the brand has a style guide with official HEX codes, those always win over values sampled from an image, especially from photos where lighting shifts color.

Turning a palette into ad colors

A palette is only useful in an ad once each color has a job. The tool suggests four roles. Background is the most dominant color, because it reads as the brand's main tone. Primary or CTA is the most saturated color that still stands apart from the background, which makes it the natural choice for buttons and key shapes. Accent is another palette color for badges and highlights. Text is the palette color with the highest contrast on the background, falling back to plain white or black when no brand color is readable enough.

A common guideline is the 60-30-10 split: about 60 percent of the ad in the background color, 30 percent in a secondary color and 10 percent in the CTA or accent color. Keeping the CTA color rare is what makes the button stand out in a busy feed.

Contrast ratios for readable ad text

Every swatch and role shows its WCAG contrast ratio, calculated from relative luminance and ranging from 1:1 (no contrast) to 21:1 (black on white). WCAG 2 asks for at least 4.5:1 for normal text and 3:1 for large text, roughly 24 px regular or 19 px bold and up. 7:1 meets the stricter AAA level.

Ads are viewed small, on phones, often in bright light, so treat 4.5:1 as the floor for headlines and offers too, not just body copy. Brand oranges, yellows and light greens often fail with white text; dark text or a darker shade of the brand color usually fixes it.

Contrast ratioWCAG levelUse it for
7:1 and upAAAAny text, including small disclaimers
4.5:1 to 7:1AAHeadlines, body copy and button labels
3:1 to 4.5:1AA large text onlyLarge headlines and non-text shapes such as button outlines
Below 3:1FailDecoration only, never text

Export formats

CSS variables give you a :root block with --brand-100, --brand-200 and so on, ordered from most to least dominant, ready to paste into a stylesheet. The Tailwind snippet adds the same colors under theme.extend.colors.brand, so you can write classes such as bg-brand-100. JSON includes HEX, RGB, HSL and share for each color, which is handy for design tokens or scripts. The PNG palette image shows each swatch with its HEX and RGB values for briefs, decks and messages to designers.

Frequently asked questions

How do I get a color palette from an image?

Upload the image to the extractor above. It downsamples the image, skips transparent pixels, groups similar colors with k-means clustering and returns 5 to 10 dominant colors with HEX, RGB and HSL values and the share of the image each one covers.

How do I extract brand colors from a logo?

Upload an SVG or high-resolution PNG of the logo, set the number of colors close to the number of colors in the logo, and turn on Ignore white and black background if it sits on a plain canvas. For exact values, click solid areas of the logo with the eyedropper.

Why are the extracted colors slightly different from my brand colors?

Each swatch is the average of a group of similar pixels, and JPG compression, anti-aliased edges and photo lighting all shift pixel values. Use the eyedropper on a flat area for a closer match, and use the official HEX codes from your brand guide when you have them.

Is my image uploaded to a server?

No. The image is read and analyzed in your browser with the canvas API. Nothing is sent to AdzImage or any other server.

What contrast ratio do ad text colors need?

WCAG 2 recommends at least 4.5:1 for normal text and 3:1 for large text. Because ads are seen small on phones, aim for 4.5:1 or higher for headlines, offers and button labels.

How many colors should a brand palette have?

Most brands work with two or three core colors plus a neutral for backgrounds and text. Extract 5 or 6 colors from a logo, then keep the ones that carry the brand and drop near-duplicates.

Can I use the palette in Tailwind CSS?

Yes. Open the Tailwind tab, copy the snippet into theme.extend.colors in your Tailwind config, and use classes such as bg-brand-100 or text-brand-200. In Tailwind v4, declare the same values in an @theme block named --color-brand-100, --color-brand-200 and so on.