File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Save transparent buffered image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Save transparent buffered image" Watch "Save transparent buffered image" New topic

Save transparent buffered image

Brandon Broschinsky
Ranch Hand

Joined: Aug 21, 2004
Posts: 41
I have a program where I allow a user to load multiple images, and then i save them to the file system, and then allow them to reload them into the viewer. that is working fine, but if a user loads a ping with transparent areas, it displays fine the first time it is loaded, but after the user saves their work and reloads it all the transparent areas are black. I am storing the images as buffered images, and am getting an array of pixels for the buffered image using the following to save the image.

int[] pixels = convertImage(bi);

and using the following to convert it back into a buffred image when the user loads the file:

int[] tempPixels = tempItem.getImage();
BufferedImage bi = createImage(tempPixels, tempItem.getSaveWidth(), tempItem.getSaveHeight());

any help on how to save the image and keep transparency would be greatly appreciated.

I agree. Here's the link:
subject: Save transparent buffered image
It's not a secret anymore!