DevTools Logo

Duotone Generator

Duotone Generator

Map an image's shadows and highlights onto two colors, preview the real gradient map and export PNG, SVG filter or CSS.

Runs in your browser

Image and duotone colors

No image loaded — showing a generated sample gradient
Drag and drop is supported on the drop zone above.

Click the preview to sample a color, then apply it to an endpoint.

Duotone preview

#0f4c5c → #ff7a59
The SVG filter reproduces the gradient map on live images; the CSS chain is only an approximation and will not match the exported raster exactly.

Preview updated for No image loaded — showing a generated sample gradient.

<filter id="duotone" color-interpolation-filters="sRGB">
  <feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0  0.2126 0.7152 0.0722 0 0  0.2126 0.7152 0.0722 0 0  0 0 0 1 0" result="gray"/>
  <feComponentTransfer in="gray">
    <feFuncR type="table" tableValues="0.0588 0.1216 0.1843 0.2471 0.3098 0.3725 0.4353 0.4980 0.5608 0.6235 0.6863 0.7490 0.8118 0.8745 0.9373 1.0000"/>
    <feFuncG type="table" tableValues="0.2980 0.3098 0.3216 0.3333 0.3451 0.3569 0.3686 0.3804 0.3961 0.4078 0.4196 0.4314 0.4431 0.4549 0.4667 0.4784"/>
    <feFuncB type="table" tableValues="0.3608 0.3608 0.3608 0.3569 0.3569 0.3569 0.3569 0.3569 0.3529 0.3529 0.3529 0.3529 0.3529 0.3490 0.3490 0.3490"/>
  </feComponentTransfer>
</filter>

Apply with filter: url(#duotone) after embedding the filter in your page.

Examples

Spotify treatment

Input
Shadow #1a1a2e, highlight #e94560
Output
Teal-to-pink gradient map

The LUT remaps every luminance step, preserving highlights.

Noir

Input
Near-black to warm white, gamma 1.2
Output
High-contrast monochrome

Gamma shifts midtones without moving the endpoints.

Approximate CSS

Input
grayscale + contrast + tint
Output
Visible but not identical

The interface labels this export as approximate.

About this tool

Duotone Generator remaps an image's tonal range onto two colors: shadows take the shadow color, highlights take the highlight color, and midtones interpolate between them. A 256-entry lookup table built from Rec.709 luma gives a true gradient map, not a grayscale-plus-filter approximation.

Adjust the gamma curve to darken or brighten midtones without moving endpoints, optionally add a third mid color, and choose from curated presets such as Spotify teal/pink, noir and sepia. The preview processes a downscaled copy for responsiveness while the export path works at full resolution with a documented cap.

Exports include PNG, JPEG and WebP images plus an SVG feComponentTransfer filter that compiles the same LUT into per-channel tables. A CSS filter chain is also provided, explicitly labelled approximate because a filter chain cannot reproduce an arbitrary gamma curve. Images are processed entirely in the browser.

What this tool does not do

  • Only the first frame of an animated GIF is processed.
  • Very large images are downscaled for preview and capped for export.
  • CSS filter output cannot reproduce gamma curves or arbitrary three-color maps.

How to use this tool

  1. Load an image

    Drop a file, paste from the clipboard, or choose one of the bundled sample photos.

  2. Pick two colors

    Set shadow and highlight colors with the pickers or load a preset; tune gamma to reshape midtones.

  3. Compare exports

    Switch between the exact SVG filter and the approximate CSS chain; read the label before copying.

  4. Download

    Choose PNG, JPEG or WebP and download the full-resolution result.

Use cases

Social graphics

Apply a consistent two-color treatment to campaign imagery.

Hover effects

Copy the SVG filter or CSS approximation for a site interaction.

Stock photo restyling

Uniformly recolour a set of images without installing an editor.

Exports

FormatNotes
PNGDefault; preserves transparency through the LUT pass
JPEGQuality-controlled; transparent pixels are flattened because JPEG has no alpha
WebPCompact output where the browser supports WebP encoding
SVG filterfeColorMatrix desaturation plus feComponentTransfer tables; needs sRGB interpolation
CSS chainApproximate hover effect only — gamma and a third anchor are not representable

Canvas re-encoding strips EXIF metadata from exported images.

Common mistakes

Mistake:Expecting a CSS filter chain to match the downloaded image.

Fix:Only the SVG filter carries the LUT; the CSS chain is explicitly approximate.

Mistake:Using identical endpoint colors and wondering why the image is flat.

Fix:The tool shows an endpoints-identical hint.

Mistake:Exporting a transparent image as JPEG.

Fix:Choose PNG or WebP when alpha matters; JPEG composites transparency.

Mistake:Assuming EXIF survives.

Fix:Canvas re-encoding strips metadata, which is a privacy benefit.

Frequently asked questions

How is this different from grayscale plus a CSS filter?

A CSS chain applies an affine transform to luminance, so it cannot reproduce a gamma curve or a three-color map. This tool builds a 256-entry lookup table and recolours each pixel from its Rec.709 luma — the downloaded image is a true gradient map.

How do I keep skin tones natural?

Choose a shadow and highlight pair close to the original tonal range and keep gamma near 1. Strong complementary pairs such as teal/pink intentionally stylise skin; a third midtone anchor can soften the transition.

Can the SVG filter run on a live website?

Yes, as an inline SVG filter in the same document: add the <svg><filter> element and apply filter: url(#duotone). Do not rely on cross-document external filter references — Chromium does not support them.

Which export formats are available?

PNG by default, plus JPEG with a quality setting and WebP. PNG and WebP preserve transparency; JPEG has no alpha, so transparent pixels are flattened.

Are my photos uploaded?

No. Decoding, LUT mapping and export all happen in the browser. Canvas re-encoding also strips EXIF metadata from the downloaded file.

What does gamma do?

Gamma reshapes midtones before the color lookup: values below 1 lift midtones, values above 1 darken them. Both endpoints stay at your chosen colors, which is why gamma is the cleanest way to adjust overall mood.

References & standards