I tried to convert a bmp:
File file = new File(source.getText());
try {
BufferedImage i = ImageIO.read(file);
if (i != null) {
BufferedImage convertedImg = new BufferedImage(i.getWidth(), i.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
boolean drawImage = convertedImg.getGraphics().drawImage(i, 0, 0, null);
File f = new File(output.getText().concat(File.separatorChar + "out.bmp"));
boolean write = ImageIO.write(convertedImg, "BMP", f);
} else {
//...
}
}catch (Exception e) {
e.printStackTrace();
}
But it doesn't write the image correctly. As I open the bmp it says the file is empty?? What am I doing wrong?
Edit: write returns false.