我在从JFrame中捕获图像后,在java中使用BufferedImage
。 我需要一些方法来锐化图像,以便当它放大时它看起来不像那么像素化。这是它保持相同的图像大小的事情。如何在java中获得更少的像素化屏幕截图?
这是我用来捕获图像的代码。
private void grabScreenShot() throws Exception
{
BufferedImage image = (BufferedImage)createImage(getSize().width, getSize().height);
paint(image.getGraphics());
try{
//ImageIO.write(image, "jpg", new File(TimeTable.path+"\\TimeLine.jpg"));
ImageIO.write(image, "jpg", new File("C:\\Users\\"+TimeTable.user+"\\AppData\\TimeLineMacroProgram\\TimeLine.jpg"));
//ImageIO.write(image, "jpg", new File("C:\\ProgramData\\TimeLineMacroProgram\\TimeLine.jpg"));
System.out.println("Image was created");
}
catch (IOException e){
System.out.println("Had trouble writing the image.");
throw e;
}
}
下面是它创建
我不使用Swing,所以这可能是关闭的。但它不完美吗?例如以SCREEN分辨率捕捉(这可能不足以满足您的需求)? – MJB 2011-06-10 22:04:40