r,g,b of pixel in range 0-256

J

jimgardener

hi
when i use BufferedImage.getRGB(...) method i can get the pixels as
integers.I need to get the r,g,b components from each of these values.
If value of a pixel(from the int[] filled by the getRGB()) is
-11382190 ,i need to get the r,g,b

i know that if r,g,b values are 82,82,82 for a pixel then they can be
packed as

int alpha=255;
int res=(alpha<<24)|(r<<16 )|( g<<8) | b ;

and res will be -11382190.
but i am not sure how to do the reverse(ie extract the components from
the above value)
can someone help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top