losing transparency when loading png file from jar into PImage

edited April 2018 in Questions about Code

I'm using the code below to successfully load and display jpg's, but when I try with a png file with a transparent background, I'm just getting a black box. I tried iterating through the pixels in img.pixels (with loadPixels() and updatePixels()) but everything's already set to -16777216....

Thanks for any suggestions.

InputStream istream = MyApp.class.getResourceAsStream("/res/images/xyz.png"); 
byte bytes[] = loadBytes(istream);
Image awtImage = new ImageIcon(bytes).getImage();
PImage img = new PImage(awtImage);

Answers

Sign In or Register to comment.