cat photolab.js
13 / 19
Photolab
A photo editor whose filters are plain arithmetic on canvas pixels, two of them my own.
- year
- 2022
- access
- -r--r--r-- (archived, read-only)

// overview
A photo editor whose filters are plain arithmetic on canvas pixels, two of them my own.
// filters as arithmetic
Every filter is a formula over each pixel's red, green and blue. Brightness multiplies, contrast stretches around the middle grey, grayscale weighs the channels by BT.709 luma instead of averaging them, and sepia is the classic matrix.
Two are my own: swap rotates the channels, and reflect inverts them and rotates them.
// never edit the original
The original pixels are copied once. Each slider change starts over from that copy and runs every active filter, so edits never pile up on one another. Both versions are kept in localStorage, and the download keeps the file's name with a -PL suffix.
// stack
- javascript
- canvas 2d