Java: BufferedImage from raw BMP file format data

Posted by Victor on Stack Overflow See other posts from Stack Overflow or by Victor
Published on 2011-03-18T23:48:09Z Indexed on 2011/03/19 0:10 UTC
Read the original article Hit count: 224

Filed under:
|
|
|
|

Hello there.

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about image