圖片類型轉換

/**

* 圖片類型轉換

* GIF->JPG

* GIF->PNG

* PNG->JPG

* PNG->GIF(X)

*/

public static void convert(String source, String result) {

try {

File f = new File(source);

f.canRead();

f.canWrite();

BufferedImage src = ImageIO.read(f);

ImageIO.write(src, "JPG", new File(result));

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}