private byte GetL8(Color c) { byte red = c.R; byte green = c.G; byte blue = c.B; // Luma (Y’) = 0.299 R’ + 0.587 G’ + 0.114 B’ from wikipedia return (byte)(((0x4CB2 * red + 0x9691 * green + 0x1D3E * blue) >> 16) & 0xFF); }