/**
* The actual scaling code.
*/
private Image scale(Image img, int width, int height) {
ImageFilter filter;
filter = new ImprovedAveragingScaleFilter(img.getWidth(null), img
.getHeight(null), width, height);
ImageProducer prod;
prod = new FilteredImageSource(img.getSource(), filter);
return Toolkit.getDefaultToolkit().createImage(prod);