开发者

Generate 32 bit depth BMP image in java

Have a requirement for any given image need to generate 32 bit depth bmp image in Java.

I googled and looked at Java Advance Image processing and Java2D, but couldnt find exact solution. Appreci开发者_运维知识库ate if any responses for the same.

Regards, Rakesh.


May be you should use ImageIO.write(..., "bmp", ...)? I say about ImageIO because you made an accent on BMP. So, you need a BMP bitmap data with BMP header.

Create BufferedImage (http://download.oracle.com/javase/1.4.2/docs/api/java/awt/image/BufferedImage.html) with required parameter and serialize it to BMP.

...
Robot robot = new Robot();
Rectangle screenRectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage image = robot.createScreenCapture(screenRectangle);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(image, "bmp", out);
...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜