Re: ImageIO - Saving JPGs
Hmm, I found an interesting solution. I just drew one image on a blank image of the other type to "convert" it. :P
Code:
public class ImageUtils
{
public static BufferedImage ARGBtoRGB(BufferedImage argbImage)
{
BufferedImage rgbImage = new BufferedImage(argbImage.getWidth(), argbImage.getHeight(), BufferedImage.TYPE_INT_RGB);
rgbImage.getGraphics().drawImage(argbImage, 0, 0, null);
return rgbImage;
}
public static BufferedImage RGBtoARGB(BufferedImage rgbImage)
{
BufferedImage argbImage = new BufferedImage(rgbImage.getWidth(), rgbImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
argbImage.getGraphics().drawImage(rgbImage, 0, 0, null);
return argbImage;
}
}
Re: ImageIO - Saving JPGs
That makes sense. Your first bit of code copies the data assuming that the data configuration is automatically BufferedImage.TYPE_INT_RGB, and it seems that this just is not so.