Writing out BMP files with DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_DOUBLE in java

Posted by Basil Dsouza on Stack Overflow See other posts from Stack Overflow or by Basil Dsouza
Published on 2010-03-27T20:33:52Z Indexed on 2010/03/27 20:43 UTC
Read the original article Hit count: 351

Filed under:
|
|

Hi Guys,

I had a problem working with the image classes in java.

I am creating a buffered image with DataBuffer.TYPE_DOUBLE. This all works fine in memory (I think). But the problem starts when I try to write it using ImageIO.write.

Initially I was getting no exception at all and instead was only getting an empty output file for my troubles..

After a bit of poking around in the code, i found out that the bmp writer doesnt support writing type_double type of files.

From: BMPImageWriterSpi.canEncodeImage:
        if (dataType < DataBuffer.TYPE_BYTE || dataType > DataBuffer.TYPE_INT)
        return false;

So my question is, does anyone have a way of writing out those kind of images to disk? any documentation or tutorial, or link would be helpful.

Thanks, Basil Dsouza

© Stack Overflow or respective owner

Related posts about java

Related posts about image