Rajnikant
Rajnikant

Reputation: 43

how to add transparent alpha channel back to png image in java?

I am trying to attach the transparent alpha channel to png image in java. Image should not be changed after merging of alpha channel. In short,

  1. I have png image of dimension p X q
  2. I have alpha channel(transparent) of 100% transparency and of size p X q
  3. Above both images(1 and 2) should be merged and image 1 should remain as it is without any effect of alpha channel... Please help me out...

Upvotes: 1

Views: 7147

Answers (1)

lbalazscs
lbalazscs

Reputation: 17809

You need to set the alpha channel in the first image according to the transparency information in the second image. Something like this: Set BufferedImage alpha mask in Java

If you don't want to have any changes in the first image, then you can create a copy/clone of it and work with this copy. Here's how to create a copy of a BufferedImage: How do you clone a BufferedImage

Upvotes: 2

Related Questions