Use PNGDecoder and PNGEncoder from www.java2s.com