Follow the shadow and highlight colors through a duotone PNG
Admin ·
A duotone effect maps how light each source pixel is to a point between two chosen colors. Start with a handful of known pixels so the endpoints and alpha are easy to inspect.
Check the shadow and highlight endpoints
Select Load example and Apply duotone. Use Shadow color #102040, Highlight color #F0C880 and Intensity 100%. Download the 4 × 2 PNG. Compare the pixels in this table using one-based positions.
| Sample position | Original RGBA | Saved RGBA |
|---|---|---|
| Top row, fourth | 255, 255, 255, 255 | 240, 200, 128, 255 |
| Bottom row, first | 0, 0, 0, 255 | 16, 32, 64, 255 |
| Bottom row, second | 64, 128, 192, 128 | 62, 66, 77, 128 |
| Bottom row, third | 18, 37, 92, 0 | 18, 37, 92, 0 |
W3C relative luminance formula for sRGBW3C Portable Network Graphics Third Edition
Measure light before choosing a new color
The tool linearizes the 8-bit sRGB channels and combines them with relative luminance weights of 0.2126 red, 0.7152 green and 0.0722 blue. Pure green therefore lands closer to the highlight than pure blue.
Luminance chooses the position between the chosen colors. The tool interpolates their encoded sRGB channels and rounds the output to 8-bit samples.
W3C relative luminance formula for sRGBW3C Portable Network Graphics Third Edition
Blend the effect with the original
Set Intensity to 50% and apply again. The red top-left pixel now stores 159, 34, 39, 255. The tool blends the original and candidate colors before rounding once.
Open both downloads and compare a transparent edge. The original alpha is preserved at every intensity.
Common questions
What happens if I choose the same color for shadows and highlights?
All visible pixels map to that same color at 100% intensity. Their original alpha is preserved.
Why can the source preview have different dimensions than its encoded header?
The local decoder applies supported orientation metadata before mapping the displayed pixels.