Is it possible to check if png image has transparency in Java? I need to convert all png images to jpg if png image doesn’t contain transparency. Is there method in Java to check this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can check if the image’s color model includes an alpha channel:
Note that This code only detects images that have been saved with alpha channel. Images with an alpha channel may still be fully opaque (i.e. alpha = 1 for all pixels).