Negative values in Image ByteBuffer?

In reading an image and examining the color values in jME, I'm getting some really weird values…



With the image I've attached, I get numbers like (just a small sampling):


XY(79,199) RGB(27,35,44)
XY(80,199) RGB(27,35,44)
XY(81,199) RGB(27,35,44)
XY(82,199) RGB(27,35,44)
XY(83,199) RGB(27,35,44)
XY(84,199) RGB(-87,-90,-111)
XY(85,199) RGB(-105,-107,-125)
XY(86,199) RGB(-123,-124,116)
XY(87,199) RGB(96,74,36)
XY(88,199) RGB(96,74,36)
XY(89,199) RGB(96,74,36)
XY(90,199) RGB(96,74,36)
XY(91,199) RGB(96,74,36)


Any ideas why this is caused?  I never have problems with displaying the images, it just seems to be what's stored in the buffer...

well simple,

they range from 0-255, you just interpret the bytes as signed, but they are not.

(+128)  should fix it

oh boy, giant facepalm :)  I was telling java.awt to use unsigned bytes and was expecting the same out of jME, this makes much more sense now…