Javaスケールによる新しい画像の生成


ズームして新しい画像を生成するには、添付ファイルのgif 4 j.jarサポートが必要です.
 
public void zoomPic(File file) throws IOException{
		
	BufferedImage img = ImageIO.read(file);   
		
	/**      */
        	int originalHeight = img.getHeight();   
        
        	/**      */
        	int originalWidth = img.getWidth();   
      
      	//          
        	File fo = new File("C:/2.jpg"); 

        
        	/**       */
        	int specialWidth = 96;
        
        	/**       */
        	int specialHeight = (specialWidth * originalHeight) / originalWidth;
        
        	if(specialHeight > 96) {
        		specialHeight = 96;
            		specialWidth = (specialHeight * originalWidth) / originalHeight;
        	}
        
        	ByteArrayOutputStream out = new ByteArrayOutputStream();   
        	BufferedImage dest = new BufferedImage(specialWidth, specialHeight,BufferedImage.TYPE_4BYTE_ABGR);   
        	dest.getGraphics().drawImage(img,0,0,specialWidth, specialHeight,null);   
        	GifEncoder.encode(dest, out);   
        	ImageIO.write(dest, "gif", fo); 

}