> I am loading PNG's and the resulting BufferedImage is of TYPE_CUSTOM. I
> need to convert it as drawing this type of image with Graphics2D is very
> slow (at least on my machine). I am converting using
> Graphics.drawImage(dest, 0, 0, null), which is very slow.
> I have looked into image.getRGB() which I suspect drawImage is using, as
> it is just as slow.
BTW: You can check this by debugging with break-points in BufferedImage.
drawImage does not use BufferedImage.getRGB(int x, int y), which indeed
would be very slow.
Instead it uses BufferedImage.getRGB(int startX, int startY, int w, int
h, int[] rgbArray, int offset, int scansize) with chunks of h=10, which
is much faster. But speed still depends on other things like type of
ColorModel and Raster. It uses ColorModel.getRGB(Object) which is quite
slow for IndexColorModel, and faster for DirectColorModel.
> Anyone know a faster way?
I see little chances to make it faster, because it is outside your
control how the PNG-Reader builds the BufferedImage.
> It is taking me 1 second to load the image and
> 1/2 a second to convert!
I can't judge these times as slow or fast without knowing width and
height of your image.

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
Thomas Fritsch - 24 Nov 2005 16:46 GMT
>> I am loading PNG's and the resulting BufferedImage is of TYPE_CUSTOM.
>> I need to convert it as drawing this type of image with Graphics2D is
[quoted text clipped - 12 lines]
> ColorModel and Raster. It uses ColorModel.getRGB(Object) which is quite
> slow for IndexColorModel, and faster for DirectColorModel.
Sorry, I confused things. The findings above apply to
drawImage(Image, AffineTransform, ImageObserver)
and probably not to your case
drawImage(Image, int x, int y, ImageObserver)

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
Never mind, after sleeping on it I implemented my own special case
converters, it is now a nice 5x faster and my interface feels much faster :)
-Ed