I had similar problem that I solved using filters. LookupOp (Java 2 Platform SE v1.4.2)
This is much faster than the pixel by pixel method you are using. I have a white image with transperent...