-
-
Save Firsto/ff9c444ac84e1118e7a54d05d217c973 to your computer and use it in GitHub Desktop.
Apply grayscale filter to ImageView in android
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
ImageView imgview = (ImageView)findViewById(R.id.imageView_grayscale); | |
imgview.setImageBitmap(bitmap); | |
// Apply grayscale filter | |
ColorMatrix matrix = new ColorMatrix(); | |
matrix.setSaturation(0); | |
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix); | |
imgview.setColorFilter(filter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment