Android : Converting color image to grayscale [duplicate]
问题 This question already has answers here : Convert a Bitmap to GrayScale in Android (5 answers) Closed 5 years ago . Hi guys I need your help, I\'m trying to convert color image into grayscale using the average of red, green, blue. But it comes out with errors, Here is my code imgWidth = myBitmap.getWidth(); imgHeight = myBitmap.getHeight(); for(int i =0;i<imgWidth;i++) { for(int j=0;j<imgHeight;j++) { int s = myBitmap.getPixel(i, j)/3; myBitmap.setPixel(i, j, s); } } ImageView img = (ImageView