D
devnew
hi
i was trying to get the rgb components of a pixel from an RGB jpeg
image
int pixels[]=new int[width*height];
bufferedimage.getRGB(0,0,width,height,pixels,0,width);
for(int x=0;x<pixels.length;x++){
int px=pixels[x];
int red=(px >> 16) & 0xFF;
int green=(px >> 8) & 0xFF;
int blue=(px) & 0xFF;
System.out.print("("+red+","+green+","+blue+") ");
this works and
a sample pixelvalue is =-6581359
with red,green,blue as 155,147,145
now what i want to know is
how can i get the orig int value (ie -6581359) from the components?
i am not quite sure about the bit shift/mask etc ..can anyone tell me
how to do this
dn
i was trying to get the rgb components of a pixel from an RGB jpeg
image
int pixels[]=new int[width*height];
bufferedimage.getRGB(0,0,width,height,pixels,0,width);
for(int x=0;x<pixels.length;x++){
int px=pixels[x];
int red=(px >> 16) & 0xFF;
int green=(px >> 8) & 0xFF;
int blue=(px) & 0xFF;
System.out.print("("+red+","+green+","+blue+") ");
this works and
a sample pixelvalue is =-6581359
with red,green,blue as 155,147,145
now what i want to know is
how can i get the orig int value (ie -6581359) from the components?
i am not quite sure about the bit shift/mask etc ..can anyone tell me
how to do this
dn