Convert images to grayscale or sepia, privately
Turn any photo black and white, or apply a warm sepia tone. This is useful for print layouts, accessibility mock-ups, vintage effects, or simply reducing visual noise — and it all runs locally so your photos never leave your device.
How it works
The image is loaded into a <canvas> and read with getImageData. For each pixel the chosen formula computes a new brightness value:
- Perceptual greyscale (default):
0.299R + 0.587G + 0.114B(ITU-R BT.601 luminance), which matches how the human eye weights brightness — green contributes most, blue least. - Simple average:
(R + G + B) / 3, treating all channels equally. - Sepia: the standard sepia matrix is applied — red, green and blue are combined in different proportions to produce a warm, amber-tinted tone reminiscent of old photographic prints.
The recomputed pixels are written back with putImageData and exported as a lossless PNG. The alpha channel is unchanged throughout, so transparent images stay transparent.
Why perceptual greyscale looks better
The human eye is far more sensitive to green light than to blue. A bright blue pixel and a less-bright green pixel may have the same numerical average of R, G, B, but the green one looks much brighter to you. The ITU-R BT.601 luminance formula accounts for this perceptual difference, so the resulting greyscale image matches how you actually experience the original photo’s brightness. Simple averaging tends to make blues look unexpectedly bright and reds look darker than expected.
Worked example
A mid-blue pixel with R=40, G=90, B=200:
| Method | Calculation | Result |
|---|---|---|
| Perceptual | 0.299×40 + 0.587×90 + 0.114×200 | 87 (a dark grey) |
| Simple average | (40 + 90 + 200) / 3 | 110 (noticeably lighter) |
The perceptual result is more natural because blue is perceived as darker than its raw channel value suggests.
When to use each mode
- Perceptual greyscale — portraits, landscapes, any photo where natural tonal balance matters
- Simple average — technical diagrams, situations where you want a mathematically neutral conversion
- Sepia — retro or vintage aesthetics, heritage content, social media posts with a nostalgic tone
Transparency and file size
The alpha (transparency) channel is not modified — only the red, green and blue channels are recomputed. Transparent PNGs stay transparent after conversion, so icons and logos with transparent backgrounds retain their shape correctly.
One common misconception: converting to greyscale does not significantly shrink the PNG file size when using a browser canvas export, because the canvas still writes all three colour channels (set equal) plus alpha. If you need a smaller file, combine the greyscale conversion with the image compressor tool.
Every pixel is processed with a <canvas> on your device — your image is never uploaded — and the result downloads as a lossless PNG.