开发者

Java: BufferedImage from raw BMP file format data

I've got BMP file's raw pixels table in byte[], it's structure is:

(b g r) (b g r) ... (b g r) padding
...  
(b g r) (b g r) ... (b g r) padding

Where r, g, b 开发者_高级运维are byte each, padding is to round row length up to a multiple of 4 bytes.

So, how can I create new BufferedImage from this raw data without copying, just using this raw data? I took a look at creating BufferedImage from DataBuffer, but I just didn't get it. Unfortunately ImageIO is not allowed in my situation.


I believe you're looking for this code or something similar. It reads 24-bit BMP images and handles padding.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜