+
Skip to content

Support for reading/writing 1 bit (black/white) BMP images? #727

Open
@dynarithmic

Description

@dynarithmic

Actual behavior

Attempting to read the attached monochrome BMP image using gil will result in an "Image types aren't compatible" exception being thrown from io_error() in error.hpp.

Expected behavior

Valid load of a valid 1-bit BMP image on the gil::read_image() call;

C++ Minimal Working Example

#include <boost/gil.hpp>
#include <boost/gil/extension/io/bmp.hpp>
#include <fstream>
namespace gil = boost::gil;

int main()
{
    std::ifstream infile("test1bpp.bmp", std::ios::binary);
    gil::rgb8_image_t img;  // <-- This line probably is not correct, but don't know what this should be
    gil::read_image(infile, img, gil::bmp_tag());
}

I am new to gil, and more than likely, the img type is not correct, which is not surprising. However I was not able to use any of the other types that are predefined without compilation error from the template compile checks, or if the compilation succeeds, the same exception being thrown at runtime ("Image types not compatible").

So I am not sure if 1-bpp images are supported in gil, and/or what should be done in the existing gil library to read the attached image.

Environment

  • Compiler version: Visual Studio 2019
  • Build settings: Debug / Release / 32-bit
  • Version (Git ref or <boost/version.hpp>): 1.81
    test1bpp.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载