我可以写图像,但它的默认分辨率是 600x450。我想指定我自己的分辨率。
public void save(String path, String name) throws IOException
{
int x ;
int y;
x=scaled.getHeight();
y=scaled.getWidth();
System.out.println(x);
System.out.println(y);
if (scaled != null)
{
name += scaled.getWidth() + "x" + scaled.getHeight();
ImageIO.write(scaled, "png", new File(path + File.separator + name + ".png"));
}
else
{
throw new NullPointerException("Scaled instance is null");
}
}
有什么建议么?