Cannot get transparency/alpha to work properly with a PNG with loadImage()
in
Programming Questions
•
3 months ago
I've read some tutorials here and there explaining that loading a PNG with alpha channel/transparency should work out of the box, however it doesn't with my current experiment. The image currently works like a GIF does, with transparency being only on or off, no alpha channel. What should I look into? I may be running out of keywords to find a proper answer. Thanks in advance!
See my Github repo:
https://github.com/jansensan/test-processing-image-with-transparency
I'm currently using Processing 2. Below is my code:
- color BG_COLOR = color(255, 0, 0);
- PImage img;
- void setup()
- {
- size(640, 360, P2D);
- background(BG_COLOR);
- img = loadImage("circle.png");
- imageMode(CENTER);
- }
- void draw()
- {
- image(img, width * 0.5, height * 0.5);
- }
1