Skip to content

Instantly share code, notes, and snippets.

@sunwicked
Created December 24, 2013 10:08
Show Gist options
  • Save sunwicked/8111194 to your computer and use it in GitHub Desktop.
Save sunwicked/8111194 to your computer and use it in GitHub Desktop.
Converting images to grayscale
// making drawable grey
ColorMatrix grayMatrix = new ColorMatrix();
grayMatrix.setSaturation(0);
ColorMatrixColorFilter grayscaleFilter = new ColorMatrixColorFilter(grayMatrix);
//getting a drawable
Drawable d = greyBtn.getBackground();
d.setColorFilter(grayscaleFilter);
greyBtn.setBackgroundDrawable(d);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment