For a Java program ("regular" program, not Applet and/or Android etc.), I have PNGs with transparency which are to be loaded and drawn atop other pictures, which is working perfectly fine. Now, for the case that there is no other picture below them (the determination of whether that is the case is not an issue, the respective code is already workingly implemented), I want them made opaque, but not in the sense of simply setting a background color; since the png source files concerned are fully colored, just with reduced opacity (alpha value) on them, it would, I guess, be no problem to simply increase the opacity of all the colors to 100%, I just don't know the commands to do it. Preferred and so far targeted way of doing it is by having them drawn in a BufferedImage, then modified respectively, but as said: How?
TLDR: images from .png with <100% opacity (same value on whole pic), how to make opaque in Java, preferrably with BufferedImage or even simpler
thanks in advance for any answers
You can try RescaleOp
to scale the alpha component all the way to opaque:
float[] scales = { 1f, 1f, 1f, 0f }; // R, G, B, A
float[] offsets = {0f, 0f, 0f, 255f}; // R, G, B, A
RescaleOp rescaler = new RescaleOp(scales, offsets, null);
BufferedImage opaque = rescaler.filter(original, null);
See this Java 2D tutorial for more info.