Image raw;
Image zoomImage;
zoomImage = raw.getScaledInstance(zoomWidth,zoomHeight,Image.SCALE_AREA_AVERAGING);
repaint();

解决方案 »

  1.   

    再给你一个Thumbnail的例子
    public  class Thumbnail extends ImageIcon {
       public Thumbnail(ImageIcon originalIcon) {
          double scale = 0.5;  // 50 %
          int w = originalIcon.getWidth() * scale;
          int h = originalIcon.getHeight() * scale;
          BufferedImage outImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);                
          AffineTransform trans = new AffineTransform();
          trans.scale(scale, scale);
          Graphics2D g = outImage.createGraphics();
          g.drawImage(originalIcon.getImage(), trans, null);
          g.dispose();
          setImage(outImage)
       }
    }
    一般步骤如下:
    1. Load the image form a file (or byte array) using java.awt.Toolkit.createImage 
    2. Create a new BufferedImage with the desired size 
    3. Get a Graphics object from the BufferedImage 
    4. Draw (and scale) your Image on to the Graphics object either with a method that scales your Image for you, or after calling Image.getScaledImage 
    5. Use a com.sun.image.codec.jpeg.JPEGImageEncoder to turn your BufferedImage into a JPEG file
      

  2.   

    javasun的tutorial中有关于图形图像的.
    http://java.sun.com/docs/books/tutorial/2d/images/filtering.html