Gradient Map and Duotone
Dark parts of the picture get your first colour, bright parts the last, with the rest in between. Pick two colours for a duotone.
https://flxcode.com/gradient-map/
or drop it here, or paste with Ctrl+V
JPG, PNG, WebP, HEIC, AVIF, GIF and BMP, up to 25 megapixels. Nothing is uploaded.
Works offline: load this page, edit one picture, turn off Wi-Fi, edit more. A JPG has no see-through areas, so they turn white.
Nothing you open or type is uploaded. How we count What this tool keeps and sends.
Problem or idea? Email us
How to make a gradient map or duotone
- Choose a picture, or drop or paste one.
- Pick a quick setting, or choose how many colours the ramp has and set each colour. Two colours make a duotone.
- The first colour is for the darkest parts, the last for the brightest. Use "Flip the ramp" to swap that.
- Press Save as PNG, or Save as JPG for a smaller file.
How brightness picks a colour
First each pixel is turned into one brightness number from 0 to 255 with the Rec. 709 weights (0.2126, 0.7152, 0.0722), rounded. That number is the position on the ramp. The original hue plays no part: pure red has brightness 54, and so does a grey of 54. Both get the same colour, #72216D.
The colours sit evenly along 0 to 255. With 3 colours they are at 0, 127.5 and 255, with 5 at 0, 63.75, 127.5, 191.25 and 255. Between two neighbours each channel changes in a straight line, so brightness 64 in the sunset ramp is #82246F. The tool builds a table of 256 colours once and looks every pixel up in it.
A duotone is just this with 2 colours: shadows in one colour, highlights in the other. That is why it is not a separate page. Amount blends the result with the original, and Flip makes the brightness 255 minus itself first.
y = round(0.2126 R + 0.7152 G + 0.0722 B) position 0 to 255
segment s = y × (n - 1) / 255, f = s - floor(s)
out = colour[floor(s)] + (colour[floor(s) + 1] - colour[floor(s)]) × f
flip: y becomes 255 - y amount: out = v + (out - v) × amount
Six colours through two ramps
Sunset is navy, pink, yellow. The duotone is dark blue and cream. The numbers come from the same code as the tool, run when this page was built.
| Colour | Code | Brightness | Sunset (3) | Duotone (2) |
|---|---|---|---|---|
| Black | #000000 | 0 | #1B1464 | #10243E |
| Pure red | #FF0000 | 54 | #72216D | #404C56 |
| Mid grey | #808080 | 128 | #E8347A | #828478 |
| Sky blue | #3A7BD5 | 116 | #D63078 | #787B72 |
| Pure green | #00FF00 | 182 | #F27761 | #B3AC90 |
| White | #FFFFFF | 255 | #FFD23F | #F4E3B1 |
Sky blue has brightness 116 and mid grey 128: different colours, close brightness, so they land close on the ramp.
What it can not do
- Stops are spaced evenly. You can not move a colour along the ramp or add a stop at an exact position.
- The ramp is mixed in sRGB values, not in linear light. Some ramps with a dark and a light colour look a little dark in the middle.
- Colour is lost on purpose: two pixels with the same brightness always get the same colour.
- Up to 25 megapixels. A JPG is saved at quality 92 and has no see-through areas.
Next: see the plain grey first · pick ramp colours from a picture
FAQ
How do I make a duotone?
Use "Duotone navy and cream" or pick 2 in "Colours in the ramp" and choose a shadow and a highlight colour. A dark first colour and a light second one work best.
What is the difference between a gradient map and a duotone?
A duotone has exactly two colours. A gradient map can have more. The method is the same, brightness picks a place on the ramp.
Why does my picture look flat after the map?
The ramp colours decide how much contrast you get. If your first and last colours are close in brightness, the picture is flat. Pick a dark first colour and a light last one.
Can I use the same colours as Photoshop gradient map?
The idea is the same, but Photoshop lets you move stops. Here they are evenly spaced. The sunset and heat settings are close in spirit, but I did not compare them to Photoshop.
What does "Flip the ramp" do?
It swaps dark and bright before the lookup, so bright parts get the first colour. It makes a negative-looking version of the same colours.
More from FLXCode
- Grayscale ImageTurn a picture grey with Rec. 709, Rec. 601, linear light or one channel. Save as PNG or JPG. Nothing is uploaded.
- Posterize ImageCut each colour channel to a few flat levels, or keep only the top bits. Save as PNG or JPG. Nothing is uploaded.
- Color Picker from ImageClick a picture to get the HEX, RGB, HSL, HSV and CMYK of any pixel, plus its dominant colors. Nothing is uploaded.
- Change Image ColorSwap one colour in a picture, or shift the colours of the whole thing. Nothing is uploaded.