Skip to content

Instantly share code, notes, and snippets.

@g-k
Created May 6, 2013 03:09
Show Gist options
  • Save g-k/5523166 to your computer and use it in GitHub Desktop.
Save g-k/5523166 to your computer and use it in GitHub Desktop.
gamma banding
// gamma correction with narrow 8-bit channel leads to banding
// where all the values aren't used
// How many are used?
// node gamma-band.js | uniq - | wc -l
for (var i = 0; i < 256; i++) {
var value = i;
value = value / 255.0;
// console.log(value);
value = Math.pow(value, 1/2.2);
// console.log(value);
value = value * 255;
// console.log(value);
console.log(Math.round(value));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment