Hi,

I am trying to grayscale bitmap as follows, But it is crashing as soon
as I run this method.
The problem is in last line. How can I assign "int" to "Color"? Or are
there any better ways? Thx

for(int y = 0; y < imgH; y++)
for(int x = 0; x < imgW; x++)
        {
                int color = bitmap.getPixel(x, y);

                int r = (color >> 16) & 0xff;
                int g = (color >> 8) & 0xff;
                int b = color & 0xff;

                color = Color.rgb(r/3, g/3, b/3);

                bm.setPixel(x, y, color);
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to