I need to write an Android-Application that uses an existing PNG-File, changes it's transparency (let's say 50%) and overwrites that file.
I already tried to open the file as a bitmap, change the paint-alpha there and save it again, but it always looses it's transparency value.
MyBitmap.compress(Bitmap.CompressFormat.PNG, 100, myOutputStream);
I already read that changing the quality-value to 0 might help, but that also didn't do the trick:
MyBitmap.compress(Bitmap.CompressFormat.PNG, 100, myOutputStream);
I can prove that my transparency-funktion works but when I try to save that image as a PNG, the transparency is lost. This is how I make the bitmap transparent:
Paint AlphaPaint = new Paint();
AlphaPaint.setAlpha(Math.round(Opacity * 255));
Canvas canvas = new Canvas(MyImage);
canvas.drawBitmap(..., ..., ..., AlphaPaint);
Any help is appreciated! Performance does not matter in this case, if using a library is the easiest way, that's definately ok. Thanks in advance!