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. Activity can't be displayed from a notification

Have you tried just launching the activity from elsewhere to see if it
actually works at all?  (For example you can use the am command to launch an

Fwiw, you don't want to use the Theme.Activity.Alert style.  Actually that
shouldn't even be part of the SDK, so I'm not sure how you are using it at
all.  (And if you are not using the SDK, you should not be here, but in

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


2. WebView - issues with back button

Step 1:
I am subclassing WebView and rendering html content properly. The
intial content is very small with a div and image /link
This is displayed in a LInear Layout along with a TextView and
ListView. That is my first screen/activity of the application.

Step 2:
When I click on a link on this webview, it goes through the
webViewclient and expands to full screen to fit the content of the
requested page.

After Step 2, I am not able to go back to my activity screen once the
content is displayed.
When I click on the back button to getback to my activity screen
close my activity and goes to the phone's  applications desktop. (i.e
goes out of my application).

Step 3:
In order to fix this issue, I stopped setting my own subclasssed
WebViewClient.  After doing this, the it seems to render the clicked
page in a webView as subactivity. Now When I click on backbutton, it
goes back to the activity screen.   But, the issue now is, I am not
catch event when a link is clicked.   How can I catch click events in
this case.


3. Just got notice of my first chargeback, any other devs getting them?

4. Positioning a Dialog at a required location (x,y)

5. MVC model state change requires creating an Intent?

6. Market spam in comments and email to developers

7. Project Name -> bin -> "classes.dex" , "resources.ap_" ??