Guide
Find a compact set of representative colors without manually inspecting every pixel. This Image Color Palette Generator analyzes a bounded sample of a JPEG, PNG or WebP image locally, groups related colors, and returns up to 3, 5, 7 or 10 HEX and RGB swatches. Copy individual codes, copy the complete HEX list, or download the displayed palette as JSON and CSS variables.
1Upload an image
Select or drag in one JPEG, PNG or WebP up to 10 MB, 20 megapixels and 16,384 pixels per side. A local preview and automatic analysis appear without a processing upload.
2Choose the palette size
Start with the default 5 colors or choose 3, 7 or 10. The generator reuses cached samples. Low-color or near-monochrome images can return fewer representative colors than requested.
3Copy or export the palette
Copy any HEX or RGB code, use Copy All Colors for the complete HEX list, or download JSON and a CSS variables file containing every displayed color.
The browser applies supported orientation and converts the decoded image to an 8-bit sRGB canvas. Analysis uses at most 128 by 128 nearest-neighbor samples, avoiding invented blended edge colors during downsampling. A small RGB histogram groups nearby samples, and deterministic alpha-weighted median cut repeatedly divides color groups. Each swatch is an actual sampled RGB color near its group's weighted center, not a random pixel or a fabricated average. Groups with more opacity-weighted samples appear first, and near-duplicate representatives are merged.
HEX writes the red, green and blue channels as two hexadecimal digits each. RGB writes the same channels as numbers from 0 to 255. For example, #30245C is rgb(48, 36, 92). Both codes describe the same opaque sRGB color and can be copied into common design and development tools. The palette exports representative colors, not the original image's transparency values.
A palette from a photograph can suggest background, surface, accent and decorative colors that feel connected to the image. Start with prominent colors, then decide which roles fit your design. A dominant color is not automatically a good text color, and extraction does not verify contrast or accessibility. Use the Image Color Picker when you need a specific pixel rather than an automatically summarized palette.
Download CSS creates a :root block with --palette-color-1, --palette-color-2 and the remaining displayed colors in order. Reference a value with var(--palette-color-1) in your own stylesheet. Download JSON saves a colors array containing every HEX and RGB pair. Files use fixed image-color-palette filenames; the source filename and image metadata are excluded. Copy All Colors puts the complete HEX list on separate lines.
Sampling resolution, color grouping, distance metrics and the requested count affect which colors survive. This tool uses a 4-bit-per-channel histogram and opacity-weighted median cut, then selects observed representatives and merges close RGB neighbors. It favors a useful summary rather than an exhaustive inventory. Repeating generation with the same samples and count is deterministic, but changing the count can change all representatives. Other tools may use different clustering or background compositing and produce different results.
Fully transparent samples are ignored. Partially transparent samples retain their decoded RGB and contribute in proportion to alpha, without being blended onto an arbitrary background. The checkerboard is preview decoration and is never analyzed. Exported swatches are opaque RGB representatives. Browser color conversion, embedded profiles, compression and alpha premultiplication can affect channel values; original HDR and high-bit-depth data are not retained. Animated PNG or WebP inputs use a frozen default or first frame.
Photo palettes can help connect illustrations, presentation themes or page decoration to a reference image. Large areas usually influence the result more than tiny details. Downsampling can miss a small accent, and close shades may be grouped, so the output is not an exact list of every source color. Monochrome images return one representative; the generator does not add unrelated colors to reach the requested count. No exact coverage percentages are claimed.
JPEG, PNG and WebP files are inspected, decoded, previewed and analyzed in this browser without a conversion upload or remote color service. The original file is unchanged. Input is limited to 10 MB, 20 megapixels and 16,384 pixels per side; unsupported or unreadable images are rejected. GIF, AVIF, HEIC, TIFF and SVG are unsupported here. Samples are reused while the page is open and cleared when you reset or choose another image. Safe analytics events can identify the tool without image bytes, source filenames or palette values.
- Finding accent colors from an authorized photograph
- Building CSS design tokens from a visual reference
- Preparing a presentation theme related to an image
- Exporting a compact palette to a design or development workflow
- Extract a bounded, deterministic summary of image colors locally.
- Choose 3, 5, 7 or 10 colors without decoding the image again.
- Copy individual HEX/RGB values or export the complete displayed palette.
- Keep transparent pixels and low-color images from producing unrelated filler colors.
How do I generate a color palette from an image?
Upload a JPEG, PNG or WebP. The browser analyzes it automatically and displays a default 5-color request. Choose another count, then copy or download the generated colors.
Can I extract HEX colors from a photo?
Yes. The generator returns HEX and RGB representatives derived from sampled photo pixels. For a specific pixel, use the separate Image Color Picker.
How many colors can I extract?
Choose a request of 3, 5, 7 or 10 colors. Images with fewer distinct groups, or with near-duplicate colors, can produce fewer swatches. No unrelated colors are added to fill empty slots.
Can I download the palette as CSS?
Yes. Download CSS saves a :root block with one --palette-color-N variable for each displayed color. JSON export is also available.
Can I copy all palette colors?
Yes. Copy All Colors copies every displayed HEX value on a separate line. Each card also has separate Copy HEX and Copy RGB actions.
Does this tool work with PNG and WebP?
Yes. JPEG, PNG and WebP are supported. Fully transparent pixels are ignored, while partially transparent samples are weighted by opacity. Animated inputs use only a frozen default or first frame.
Is the Image Color Palette Generator free?
Yes. Local generation, copying and JSON/CSS exports are free without signup.
Are my uploaded images stored on a server?
The selected file is processed locally in your browser. This tool has no image-upload endpoint or server image storage. Site analytics can record safe tool events without the image, filename or palette values.
Why are some colors missing from the generated palette?
A small palette summarizes the image rather than listing every pixel color. Downsampling can miss fine details, close shades are grouped, transparent pixels are skipped and the requested count limits the result.
What is the difference between Image Color Picker and Color Palette Generator?
Image Color Picker reads a pixel you choose. This generator automatically groups many sampled pixels to suggest representative colors and exports the complete generated palette.