Created
December 10, 2015 20:58
-
-
Save akuafif/19ab4aa6cf0aac3c89e7 to your computer and use it in GitHub Desktop.
[Java/Android] Convert a Picture from an ImageView into GrayScale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert Imageview to grayscale | |
private void convertToGrayScale(ImageView imageView, boolean convert) { | |
if (!convert) { | |
ColorMatrix matrix = new ColorMatrix(); | |
matrix.setSaturation(0); | |
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix); | |
imageView.setColorFilter(filter); | |
} else { | |
imageView.setColorFilter(null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment