T
tiewknvc9
Hi!
i wrote some code that takes a rendered image and successfully converts
it into a JPEG image. Unfortunately I need it to be in a "PNG" format,
luckily a PNG imagewriter is built into java!
The only thing is that when I try to write a png file, it always comes
out as 100% white, but if I write the same rendered image to a jpeg it
looks right. What a pain. Here is the code I am working with
the buffered image is an image that has a black background
by changing all png's to jpg's, I get a wildly successful jpeg image of
a black background! but as a png its just white.
i wrote some code that takes a rendered image and successfully converts
it into a JPEG image. Unfortunately I need it to be in a "PNG" format,
luckily a PNG imagewriter is built into java!
The only thing is that when I try to write a png file, it always comes
out as 100% white, but if I write the same rendered image to a jpeg it
looks right. What a pain. Here is the code I am working with
the buffered image is an image that has a black background
Code:
RenderedImage renImage = (RenderedImage)bufferedImage;
//Write generated image to a file
try {
// Save as PNG
if (renImage != null){
File filImg = new File("jb" + lImageCount + ".png");
ImageIO.write(renImage, "png", filImg);
}}
by changing all png's to jpg's, I get a wildly successful jpeg image of
a black background! but as a png its just white.