개발환경
HW: Apple Macbook Pro 13" early 2011 (i7@2.7 / 4g / intel graphic)
OS: Mac OSX 10.8.2 (mountain lion)
IDE: Eclipse Juno
JDK: 1.6
 
이미지 몇 백장을 리사이즈하고 앞으로 이 일이 반복될 것 같은 끔찍한 느낌이 들어서 걍 만듬..
ImageIcon 으로 리사이징된 이미지를 리턴해줌... 소스코드는 메인이랑 함수 딸랑 하나 있는 클래스랑..  끝임.
원래 할라고 했던 것들은..
1. 처음에 구동하면 최대 width * height 적어줌 (width나 height중 원본 사이즈와 비교해서 원본대비 더 큰 것에 맞춰서 비율을 맞춰서 줄여줌..)
2. 다이얼로그 박스가 떠서 디렉토리를 선택
3. 프로그레스 바와 로그 텍스트가 나와서 얼마나 됐고 무슨 이미지들을 바꿨는지 찍어줌 
근데 귀찮아서
width*height는 그냥 함수 인자로 넣고 / 경로도 걍 소스에 string에 대입하고 / 어떤 파일 리사이징 됫는지 콘솔창에 찍힘 
근데 다시 고칠라나? 귀찮을듯.. 나중에 심심하면 할듯 --;
자바로 짠 이유는 노트북에 obj-c랑 java랑 python이 깔려있는데 마침 eclipse를 켜놨었음..
ImageResize.java
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
public class ImageResize {
	public static ImageIcon resizeImage(String fileName, int maxWidth, int maxHeight){
		String data = fileName;
		BufferedImage src, dest;
		ImageIcon icon;
		
		try{
			src = ImageIO.read(new File(data));
			
			int width = src.getWidth();
			int height = src.getHeight();
			
			if(width > maxWidth){
				float widthRatio = maxWidth/(float)width;
				width = (int)(width*widthRatio);
				height = (int)(height*widthRatio);
			}
			if(height > maxHeight){
				float heightRatio = maxHeight/(float)height;
				width = (int)(width*heightRatio);
				height = (int)(height*heightRatio);
			}
			
			dest = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
			Graphics2D g = dest.createGraphics();
			AffineTransform at = AffineTransform.getScaleInstance((double) width / src.getWidth(), (double)height / src.getHeight());
			g.drawRenderedImage(src, at);
			
			icon = new ImageIcon(dest);
			return icon;
		}catch(Exception e){
			 System.out.println("This image can not be resized. Please check the path and type of file.");
	         return null;
		}
	}
}
Main.java
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
public class Main {
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		String path = "/Users/TY/Dropbox/사진/";
		File dirFile = new File(path);
		File [] fileList = dirFile.listFiles();
		
		for(File t:fileList){
			String tmpPath = t.getParent();
			String tmpFileName = t.getName();
			int extPosition = tmpFileName.indexOf("jpg");
			if(extPosition != -1){
				String fullPath = tmpPath+"/"+tmpFileName;
				ImageIcon ic = ImageResize.resizeImage(fullPath, 1024, 1024);
				
				Image i = ic.getImage();
				
				BufferedImage bi = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_RGB);
				
				Graphics2D g2 = bi.createGraphics();
				g2.drawImage(i, 0, 0, null);
				g2.dispose();
				
				String newFileName = tmpFileName.replaceFirst(".jpg", "_resize.jpg");
				
				String newPath = tmpPath+"/"+newFileName;
				
				ImageIO.write(bi, "jpg", new File(newPath));
				
				System.out.println(newPath);
			}
		}
		System.out.println("FIN");
	}
}