RGB from bitmap

by Andareena Vootog » Tue, 03 Nov 2009 06:05:20 GMT

Sponsored Links
        if you are using bitmap, use an integer array to store the bitmap.
use bitmap.getPixel() to get the corresponding bitmap in integer array. By
using bitwise rotation operation, we will get RGB values. (Also byte array
can be used). See the code below.

             int[] pix = new int[picw * pich];
            bitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);

            int R, G, B,Y;

            for (int y = 0; y < pich; y++)
            for (int x = 0; x < picw; x++)
                int index = y * picw + x;
                int R = (pix[index] >> 16) & 0xff;     //bitwise shifting
                int G = (pix[index] >> 8) & 0xff;
                int B = pix[index] & 0xff;

                //R,G.B - Red, Green, Blue
                 //to restore the values after RGB modification, use //next
                pix[index] = 0xff000000 | (R << 16) | (G << 8) | B;

Thanks and Regards,

Andarena Vootog
Vootog Information Systems < http://www.vootog.com > Pvt Ltd.


RGB from bitmap

by Jeffrey Blattman » Tue, 03 Nov 2009 06:07:42 GMT

Other Threads

1. FM application on Android.


Is there any open-sourced application for android for FM Radio [Not the
internet radio apps...].
Is there a plan to have a framework which involved FM ? [Assuming my
hardware has an FM chip].


unsubscribe: android-porting+unsubscr...@googlegroups.com

2. Motorola A810 with Android

Please provide information to port android on motorola A810 model. I
have seen some videos on you tube but not able to understand the same.
Please help.
unsubscribe: android-porting+unsubscr...@googlegroups.com

3. dalvikvm crashing while starting Wifi

4. Dialog box

5. why doesn't this work? Simple question - I hope...

6. face detection in Android

7. looking for developer experienced in Open GL to write a fun app for Android