java 對GIF動態檔案縮圖處理
/**
* GIF檔案縮圖處理函式 srcImg 源圖 destImg 縮圖
*
*/
public static void getGifImage(File srcImg, File destImg, int width,
int height, boolean smooth) {
try {
GifImage gifImage = GifDecoder.decode(srcImg);// 建立一個GifImage物件
GifImage resizedGifImage2 = GifTransformer.resize(gifImage, width, height, smooth);//1.縮放重新更改大小.
GifEncoder.encode(resizedGifImage2, destImg,true);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
File file1 = new File("e://p1.gif");
File file2 = new File("e://prose1.gif");
getGifImage(file1,file2,240,320,true);
File file3 = new File("e://p2.gif");
File file4 = new File("e://prose2.gif");
getGifImage(file3,file4,240,320,true);
}