Re: [JAVA2D] BufferedImage.getRGB BufferedImage.setRGB

2009-01-14 Thread java2d
Everyone, Thanks for you responces, turned out to be as Jim said I was using jpg and it didn't occour to me it may not be lossless, so I've changed to saving in png format and it's all good now. Thank you all again, Chris [Message sent by forum member 'cocopopsicle' (cocopopsicle)]

Re: [JAVA2D] BufferedImage.getRGB BufferedImage.setRGB

2009-01-13 Thread java2d
To extract components: int a = (rgb 24) 0xFF; int r = (rgb 16) 0xFF; int g = (rgb 8) 0xFF; int b = (rgb 0) 0xFF; (note triple shift). To set components: (a 24) | (r 16) | (g 8) | b; (note the first part, although that

Re: [JAVA2D] BufferedImage.getRGB BufferedImage.setRGB

2009-01-13 Thread java2d
Krill, Thanks for the suggestion, I have tried this, and where as the pixels in the image are showing as blue when I reload the image non of the pixels have their blue component set at 255, I am manually setting alpha = 255 red = 0 green = 0 blue = 255 however blue is being set to 254 alpha

Re: [JAVA2D] BufferedImage.getRGB BufferedImage.setRGB

2009-01-13 Thread java2d
What happens with this sequence: int newVal = ... image.setRGB(x, y, newVal); int newVal2 = image.getRGB(x,y); System.out.println(newVal == newVal2); Does it print false? [Message sent by forum member 'kirillcool' (kirillcool)] http://forums.java.net/jive/thread.jspa?messageID=325883

Re: [JAVA2D] BufferedImage.getRGB BufferedImage.setRGB

2009-01-13 Thread Dmitri Trembovetski
jav...@javadesktop.org wrote: What happens with this sequence: int newVal = ... image.setRGB(x, y, newVal); int newVal2 = image.getRGB(x,y); System.out.println(newVal == newVal2); Does it print false? Note that there are conditions when it will indeed print false. For example, for

Re: [JAVA2D] BufferedImage.getRGB BufferedImage.setRGB

2009-01-13 Thread Jim Graham
What format are you saving it as? Note that the JPG image format is lossy so the image written to disk might be different from the image you handed to the writer (off by 1s would be common). PNG is a lossless format so it will write out exactly the pixels you hand to it. Also, what format