Create a grayimage from scratch. Use image.getRaster().getDataBuffer()
example program

GrayImage.java.txt