Image srcImg = ImageIO.read(file);
BufferedImage buffImg = null;
buffImg = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
buffImg.getGraphics().drawImage(srcImg.getScaledInstance(50, 50, Image.SCALE_SMOOTH), 0, 0, null);
ImageIO.write(buffImg, "gif", new File("C:/logs/submit_50x50.gif"));
转换图片格式 尺寸
图片缩放与格式转换
最新推荐文章于 2025-05-14 00:15:00 发布
本文介绍了一种使用 Java 编程语言进行图片缩放和格式转换的方法。具体步骤包括:读取原始图片文件,创建一个新的 50x50 像素的 BufferedImage 对象,并将原始图片按平滑缩放的方式调整尺寸以适应新的 BufferedImage,最后将调整后的图片保存为 GIF 格式。
343

被折叠的 条评论
为什么被折叠?



