Also, you can use ImageIO to convert your gif image to png - just read it and then write as png.
For example, you can read your gif images directly into a 1-bit trtanslucent 24 bit image - take a look at javax.imageio.ImageReader.readl(int imageIndex, ImageReadParam param) method. In the param you can specify a destination buffered image. Then you can write that image in png format to a file (if that's your goal - it's still not clear to me what are you trying to achieve).
sorry for the confusing subject,
i mean gif to png is not convert my gif image into png using java
the one i want to do is using 24-bit png with one transparent color in my game
i need the code
to convert green color in my png image to transparent color
btw, what's the difference mask, transparent, and alpha??
May be I'm missing something, but why not just copy your original image to a 1-bit transparent image? It'll be much more efficient.
what's 1-bit transparent? i'm getting totally confuse in this transparent stuff
The code should look something like this:
Image newImage = gc.createCompatibleImage(width, height, Translucency.BITMASK);
Graphics2D g = (Graphics2D)newImage.getGraphics();
g.drawImage(origImage, 0, 0, null);
can't compile. is that really Translucency? or Transparency?
and where to set the transparent color in that code?