Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3494136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:58:10+00:00 2026-05-18T11:58:10+00:00

This question is a duplicate of this question: Making every pixel of an image

  • 0

This question is a duplicate of this question:
Making every pixel of an image having a specific color transparent

But I need a Java equivalent. And I need a image-type (like PNG, BMP, …) which can hold this color with full transparency (alpha = 0). And of course a way to save it as a file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:58:10+00:00Added an answer on May 18, 2026 at 11:58 am
    import java.awt.*;
    import java.awt.image.*;
    
    public class Transparency {
      public static Image makeColorTransparent
        (Image im, final Color color) {
        ImageFilter filter = new RGBImageFilter() {
          // the color we are looking for... Alpha bits are set to opaque
          public int markerRGB = color.getRGB() | 0xFF000000;
    
          public final int filterRGB(int x, int y, int rgb) {
            if ( ( rgb | 0xFF000000 ) == markerRGB ) {
              // Mark the alpha bits as zero - transparent
              return 0x00FFFFFF & rgb;
              }
            else {
              // nothing to do
              return rgb;
              }
            }
          }; 
    
        ImageProducer ip = new FilteredImageSource(im.getSource(), filter);
        return Toolkit.getDefaultToolkit().createImage(ip);
        }
    }
    

    Modified the code to make each pixel transparent

    Source :http://www.rgagnon.com/javadetails/java-0265.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is a duplicate of 1042830 , but MonoTouch-specific. Is there a way
I hope this question is not a duplicate but I didn't find anything equivalent
This is basically a duplicate of this question , but the accepted answer was
I realize that this might be a duplicate question but this question is very
Closed as exact duplicate of this question . But reopened, as the other Singleton
edit: this question was closed as a duplicate, but the identified duplicate was asked
I know this question was asked before, but before marking it as a duplicate,
I agree that this question is duplicate. Please bear with me. I was also
EDIT: This question is a duplicate of What is the difference between managed and
Update: This question is a duplicate of Are there any programming languages targeting PHP,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.