I'm reading a PNG image with the following code:
BufferedImage img = ImageIO.read(new URL(url));
Upon displaying it, there is a black background, which I know is caused from PNG transparency.
I found solutions to this problem suggesting the use of BufferedImage.TYPE_INT_RGB
, however I am unsure how to apply this to my code above.
Create a second
BufferedImage
of typeTYPE_INT_RGB
...Paint the original to the copy...
You now have a non transparent version of the image...
To save the image, take a look at Writing/Saving an Image