You can try something like the following:

    Bitmap grayscaleBitmap = Bitmap.createBitmap(
        colorBitmap.getWidth(), colorBitmap.getHeight(),
        Bitmap.Config.RGB_565);
    Canvas c = new Canvas(grayscaleBitmap);
    Paint p = new Paint();
    ColorMatrix cm = new ColorMatrix();
    cm.setSaturation(0);
    ColorMatrixColorFilter cmcf = new ColorMatrixColorFilter(cm);
    p.setColorFilter(cmcf);
    c.drawBitmap(colorBitmap, 0, 0, p);

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Jul 8, 3:22 pm, Sharmila <[email protected]> wrote:
> Hi guys,
> I have a camera application that captures a 640x480 image.I want to
> convert this image to grayscale.I know I have to use the setSaturatio
> (float sat) in the ColorMatrix method to zero but I dnt know how I can
> set it to grayscale...
> Can someone please help me out?
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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