How to change a bitmap’s opacity?

As far as I know, opacity or other color filters can’t be set on the Bitmap itself. You will need to set the alpha when you use the image: If you’re using ImageView, there is ImageView.setAlpha(). If you’re using a Canvas, then you need to use Paint.setAlpha(): Paint paint = new Paint(); paint.setAlpha(100); canvas.drawBitmap(bitmap, src, … Read more

Merging two images

Just create a new BufferedImage with transparency, then paint the other two images (with full or semi-transparency) on it. This is how it will look like: Sample code (images are called ‘image.png’ and ‘overlay.png’): File path = … // base path of the images // load source images BufferedImage image = ImageIO.read(new File(path, “image.png”)); BufferedImage … Read more

Transparency for windows forms textbox

You need to try out something like this. Add a new user control , say CustomTextBox and change public partial class CustomTextBox : UserControl to public partial class CustomTextBox : TextBox You will then get the following error saying that the ‘AutoScaleMode’ is not defined. Delete the following line in the Designer.cs class. this.AutoScaleMode = … Read more

Can PNG image transparency be preserved when using PHP’s GDlib imagecopyresampled?

imagealphablending( $targetImage, false ); imagesavealpha( $targetImage, true ); did it for me. Thanks ceejayoz. note, the target image needs the alpha settings, not the source image. Edit: full replacement code. See also answers below and their comments. This is not guaranteed to be be perfect in any way, but did achieve my needs at the … Read more