[quote] I don’t want to go through all my GIFs and make the background transparent.
[/quote]
Then write a program to do it for you.
You realy should have the image data in the format expected by the program that will be using it.
As for how to do it, its pretty simple.
Something along these lines should do it :-
(btw I havn’t compiled or run this so dunno if it’ll work :P)
BufferedImage loadedImage = ImageIO.read(url);
IndexColorModel icm = (IndexColorModel)(loadedImage.getColorModel()); //assume image has a IndexColorModel(i.e. a gif)
if(icm.getTransparency()!=Transparency.OPAQUE) return; //image already has transparency.
//now, get the colormap and find a Color matching Color.PINK
//(or whatever color you want to make transparent)
int [] cmap = new int[icm.getMapSize()];
icm.getRGBs(cmap);
int transColor = Color.PINK.getRGB();
int transIndex = -1;
for(int i =0;i< cmap.length;i++)
{
if(cmap[i]==transColor)
{
transIndex = i;
break;
}
}
if(transIndex==-1) return; //no pixels are the correct Color
//now we have the index of the color we want as transparent, we need to create a ColorModel.
IndexColorModel newIcm = new IndexColorModel(icm.getPixelSize(), cmap.length, cmap, 0, true, transIndex, icm.getTransferType());
//now we just need to pass this new ColorModel and the raster of the original image into a new BufferedImage
BufferedImage finalImage = new BufferedImage(newIcm,loadedImage.getRaster(),loadedImage.isAlphaPremultiplied(),null);