2
votes

I wrote a java app to capture screen into true color images, make parts of them transparent, and write them to disk as PNG files with transparency using ImageIO. Now to conserve space I am thinking of converting true color images to 8-bit 256 colors images, making one of the colors transparent, and writing them as GIFs to disk.
I was having hard time making that conversion to work. So does anybody have a code spinet how to create 256 transparent image files in Java?

1

1 Answers

1
votes

You can use PNG8 files with alpha transparency as well. It might give files smaller than GIF.

If you can call commandline executable, then you can use pngquant.

If you want a pure-Java solution, then Neuquant has a Java port, but the Java version is based on old version that doesn't support transparency (it wouldn't be hard to add if you follow changes in pngnq).