private void decodeJPEGGray(BufferedImage image,InputStream data)throws IOException{
WritableRaster raster=image.getRaster();
DataBufferByte buffer=(DataBufferByte)raster.getDataBuffer();
byte[] imgdata=(byte[])buffer.getData();
new JFIFInputStream(data).read(imgdata);
}