I'm working on a tool for Android that takes a png as an input, rescale it for several densities and save them in a directory. (Project that can be found here : https://code.google.com/p/9patch-resizer/
In order to open images, I'm using ImageIO's function readImage (http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html#read(java.io.File))
But I've having some trouble with some PNG-8 files, that I shrunk to minimum size thanks to ImageOptim
The thing is, if I open this image with ImageIO, it discards the transparency information and that's annoying. (Meaning, when I rescale it, and save it later, the transparency is discarded)
Here is the image I'm talking about: and the rescaled output:
If I'm using Toolkit's createImage method (http://docs.oracle.com/javase/6/docs/api/java/awt/Toolkit.html#createImage(java.lang.String)) instead of ImageIO's method to get the image, it works correctly, but I don't have get the informations such as color model, etc...
Here's a PoC that does the trick for me: