public static void main(String[] args) throws Exception {
File source = new File("E://1.bmp");
String type = "gif";
BufferedImage inImg = ImageIO.read(source);
int wideth = inImg.getWidth(null);
int height = inImg.getHeight(null);
BufferedImage bimage = new BufferedImage(wideth, height,
BufferedImage.SCALE_SMOOTH);
bimage.getGraphics().drawImage(inImg, 0, 0, wideth, height, null);
File outfile = new File("E://2.gif");
OutputStream out = new FileOutputStream(outfile);
ImageIO.write(bimage, type, out);
source.delete();
out.close();
}
JAVA图片类型转换
最新推荐文章于 2024-04-17 02:22:25 发布