I am trying to convert java qt QImage to BufferedImage using the following code, but it does't work
QImage image = map.toImage();
byte buf[] = image.copyOfBytes();
InputStream in = new ByteArrayInputStream(buf);
try {
BufferedImage img = javax.imageio.ImageIO.read(in);
File file = new File("newimage.bmp");
ImageIO.write(img, "bmp", file);
} catch (Exception e) {
}