Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save transparent buffered image

 
Brandon Broschinsky
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic