Skip to content

Instantly share code, notes, and snippets.

@zaki50
Created July 2, 2011 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaki50/1061801 to your computer and use it in GitHub Desktop.
Save zaki50/1061801 to your computer and use it in GitHub Desktop.
random_dithering.java
final int p = pixels[i];
final int r = Color.red(p);
final int g = Color.green(p);
final int b = Color.blue(p);
final int y = g * 587 / 1000 + r * 299 / 1000 + b * 114 / 1000;
int yb = (y < rand.nextInt(256)) ? 0 : 255;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment