Low-Level Pixel Buffer Mathematics
Every visual effect in this tool operates via direct vector transformation of the canvas pixel buffer. In standard 24-bit TrueColor imagery, an image of dimensions $W \times H$ comprises a continuous array of $W \times H \times 4$ scalar byte values:
// 1. Negative Inversion:
R' = 255 - R; G' = 255 - G; B' = 255 - B;
// 2. Photopic Luminance Grayscale (ITU-R BT.601):
L = (0.299 × R) + (0.587 × G) + (0.114 × B);
// 3. Linear Duotone Interpolation (lerp):
R' = ColorA.R + (ColorB.R - ColorA.R) × (L / 255);
The Nostalgic Chemistry of Sepia Toning
In 1880s analog photography, black-and-white silver gelatin prints were vulnerable to atmospheric oxidation and fading caused by sulfur dioxide in industrial smog. Photographers soaked prints in sepia toner containing potassium ferricyanide and sodium sulfide, which converted metallic silver into silver sulfide—a significantly more chemically stable compound with a warm reddish-brown hue. Our sepia matrix replicates this historical chemical transformation digitally:
R' = min(255, 0.393R + 0.769G + 0.189B)
G' = min(255, 0.349R + 0.686G + 0.168B)
B' = min(255, 0.272R + 0.534G + 0.131B)