How to get a image RGB value?

hi,

i am a newcomer here. when i want to get a bufferedimage's RGB value, i used

bufferedimage.getRGB(startx,starty, width of the image,height of the image, rgbs,0,width of the image);

but what the rgbs[] returned were something like -16711552,

what's the problem with my coding?

Thans in advance!

[340 byte] By [newcomer2006a] at [2007-10-2 11:36:34]
# 1

2 methods:

Using Color:

Color c = new Color(bi.getRGB(...));

int r = c.getRed();//r in [0 - 255]

//c.getGreen() c.getBlue();

Direct [not recommended until u understand wats goin on]:

int c = bi.getRGB(...);

int r = (c >> 16) & 0xFF;//again r in [0 - 255]

int g = (c >> 8) & 0xFF;

int b = c & 0xFF;

bhupendra.aolea at 2007-7-13 5:11:11 > top of Java-index,Security,Cryptography...
# 2
Thanks a lot
newcomer2006a at 2007-7-13 5:11:11 > top of Java-index,Security,Cryptography...