lossless (?) compression with PNG
843807Nov 14 2003 — edited Nov 19 2003Hello
I'm working on this project where I hide data in PNG images. Briefly I do the following:
1) read the PNG into a BufferedImage using ImageIO
2) extract the RGBA pixel info of the image using PixelGrabber
3) mask in the bits I want to hide in the lower 2 bits of the RGBA channel bytes
4) construct a MemoryImageSource object using the pixels and pass that to createImage and generate an Image X.
5) Create an empty BufferedImage Y (ARGB format) and draw X in Y (using Y's Graphics2D)
6) Save Y as a new PNG with ImageIO
The problem I'm having is that later when I read Y in again using ImageIO, the pixels data is not identical to what I saved. I.e. the BufferedImage containing the hidden data gets modified slightly when I save it and read it in again. I'm not sure why this happens, since PNG should ideally preserve all the pixel info.
Any suggestions/comments ?
srinivas