现在在使用Graphics2D进行合成图片 将用户头像(宽高不确定,可几百 可几千的正方形头像)放在底板225x225的小正方形内 但是会将原图头像的质量缩小很多 失真 模糊 请问各位大佬有没有可以改变图片的宽高但不改变图片的质量
String s = dynamicServiceImpl.downLoadUrl(shareUrl,request);
File file = new File(s);
Image src = ImageIO.read(file);
BufferedImage image = new BufferedImage(664, 728,
BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.setBackground(Color.WHITE);
g.setColor(Color.WHITE);
g.fillRect(0,0,664,728);
//头像覆盖
String profilePhoto = dynamicServiceImpl.downLoadUrl(appUser.getProfilePhoto(),request);
//updateForm(profilePhoto);
//getSix(profilePhoto);
File fileAppUser = new File(profilePhoto);
Image srcApp = ImageIO.read(fileAppUser);
int wideth_profile = 225;
int height_profile = 225;
g.drawImage(srcApp, 220,
120, wideth_profile, height_profile, null);
//底板覆盖
g.drawImage(src, 0, 0, 664, 728, null);
```上面的代码是将图片下载下来然后先放在模板上 再放上一个底板 请教一下各位大佬