Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Transparent GIFs

Posted on 1998-07-19
3
Medium Priority
?
295 Views
Last Modified: 2010-03-30
How can I find out the transparent color (RGB) of a GIF in Java app. I have succeeded in finding transparent color INDEX, but this doesn't help, unless I can get the color pallete of the image. Unfortunately my knowledge of Java isn't that good yet.

0
Comment
Question by:shimon_crown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:tomd012698
ID: 1227044
 Are you simply trying to display a transparent image, or are you attempting to process the image?
0
 

Author Comment

by:shimon_crown
ID: 1227045
I would like to process the image.
0
 
LVL 16

Accepted Solution

by:
imladris earned 200 total points
ID: 1227046
You can find the colour that is being used as the transparent one by writing an imagefilter; the following one will do:

class TransFilter extends RGBImageFilter
{      static int transcol;

      TransFilter()
      {      canFilterIndexColorModel=true;
            return;
      }

      public int filterRGB(int x,int y,int rgb)
      {      if((rgb&0xff000000)==0)transcol=rgb;
            return(rgb);
      }
}

Colour is encoded in the rgb variable as: alpha channel, red, green and blue in the respective four bytes. So when the alpha channel is 0 (transparent) store the colour in transcol for later inspection.

Remember that for the filter to be activated the image must get "used" in some fashion, for instance displaying it, or loading it with a mediatracker etc.

If you need more specifics on how to use a filter, feel free to ask.

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question