public InputStream getImageStream(BufferedImage bimage){
        InputStream is = null;
        ByteArrayOutputStream bs = new ByteArrayOutputStream();
        ImageOutputStream imOut;
        try {
        imOut = ImageIO.createImageOutputStream(bs);
        ImageIO.write(bimage, "png",imOut);
        is= new ByteArrayInputStream(bs.toByteArray());
        } catch (IOException e) {
        e.printStackTrace();
        return is;