Get rgb value of image when user clicked on image

I am creating a map application. I need to get the RGB value of an image when the user clicked on the image. The image is in ImageView

.

Please, help.

+3


source to share


2 answers


int ColorCode = imageView.getDrawingCache().getPixel(x, y);

      

// here x, y are coordinates



here is the link

+2


source


Bitmap bitmap = ((BitmapDrawable)imageView.getBackground()).getBitmap();  
int pixel = bitmap.getPixel(xCordinate,yCordinate);  
int redValue = Color.red(pixel);  
int blueValue = Color.blue(pixel);  
int greenValue = Color.green(pixel);

      



0


source







All Articles