Hi,

There seem to be a bug in the BMP plugin. I've tried to write a single channel file, using the following call:

    ImageSpec spec(width, height, 1, TypeDesc::UINT8);
    if(out->open("Test.bmp", spec)) {
        success = out->write_image (TypeDesc::FLOAT, buffer);
        out->close();
    }

and the resulting file seems to be corrupted. It does contains some data, but the configuration is not correct:
OIIO cannot reopen the image.
GIMP sees a grayscale black image
Photoshop sees a indexed color image, with an completely black color table. Building a grayscale color table fixes the problem.

The depth of the image is computed using:
    m_dib_header.bpp = m_spec.nchannels << 3;
From this page (http://msdn.microsoft.com/en-us/library/windows/desktop/dd183386%28v=vs.85%29.aspx) I understand that 8bpp files (which is the case if I write only one channel) must be palettized. "Bitmaps that are 1, 4, or 8 bpp must have a color table with a maximum size based on the bpp".

So my guess is that the plugin should create a grayscale palette if 'nchannel' is equal to 1.

Any thoughts ?
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to