// create a BufferedImage of only 1 pixel height for fetching the rows
// of the image in the correct format (ARGB)
// This speeds up things by more than factor 2, compared to the standard
// BufferedImage.getRGB solution
BufferedImage row = new BufferedImage(width, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = row.createGraphics();
int pixels[] = ((DataBufferInt) row.getRaster().getDataBuffer()).getData();
// make sure alpha values do not add up for each row:
g2d.setComposite(AlphaComposite.Src);
// calculate scanline by scanline in order to safe memory.
// It also seems to run faster like that