我有一个应用程序捕获屏幕截图并从捕获的图像创建视频。但问题是,当视频生成时,生成的视频中的颜色非常粉红。我认为这是因为我正在使用BufferedImage.TYPE_3BYTE_BGR类型操纵捕获的图像以显示游标。有人能告诉我如何解决这个问题,我想让视频的颜色与屏幕的实际颜色相同。BufferedImage颜色变化
用于捕捉我做的画面如下:
Robot robot = new Robot();
Rectangle captureSize = new Rectangle(screenBounds);
return robot.createScreenCapture(captureSize);
对于如下操作我做图片:
image = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
if (true) {
int x = MouseInfo.getPointerInfo().getLocation().x - 25;
int y = MouseInfo.getPointerInfo().getLocation().y - 37;
Graphics2D graphics2D = sourceImage.createGraphics();`enter code here`
graphics2D.drawImage(SimpleWebBrowserExample.m_MouseIcon, x, y, 48, 48, null);
}
image.getGraphics().drawImage(sourceImage, 0, 0, null);
return image;
请告诉我如何与颜色相同,实际得到的图像屏幕上的颜色。
谢谢。
另请参阅['RescaleOp'](http://stackoverflow.com/questions/5838842/java-lang-illegalargumentexception-number-of-scaling-constants-does-not-equal-th/5839425#5839425)。 – trashgod 2011-05-25 11:01:58
请参阅['convertToCompatible()'](http://groups.google.com/group/comp.lang.java.help/msg/bf9c8aa1e05d9f24)。 – trashgod 2011-12-24 16:56:58