public class tt {
public static void main(String[] args) throws IOException
{
try {
resizeImage("D:\\11.jpg","E:\\33.jpg",1808,737);
} catch (IOException e) {
System.out.println("图片转换出现异常!");
}
int width, int height) throws IOException {
File srcFile = new File(srcImgPath);
Image srcImg = ImageIO.read(srcFile);
BufferedImage buffImg = null;
buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
buffImg.getGraphics().drawImage(
srcImg.getScaledInstance(width, height, Image.SCALE_SMOOTH), 0,
0, null);
ImageIO.write(buffImg, "JPEG", new File(distImgPath));
}
}
public static void main(String[] args) throws IOException
{
try {
resizeImage("D:\\11.jpg","E:\\33.jpg",1808,737);
} catch (IOException e) {
System.out.println("图片转换出现异常!");
}
}
int width, int height) throws IOException {
File srcFile = new File(srcImgPath);
Image srcImg = ImageIO.read(srcFile);
BufferedImage buffImg = null;
buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
buffImg.getGraphics().drawImage(
srcImg.getScaledInstance(width, height, Image.SCALE_SMOOTH), 0,
0, null);
ImageIO.write(buffImg, "JPEG", new File(distImgPath));
}
}