boostorg / boostorg/gil

Writing a gray16 PNG image on disk always results on an empty (all 0) image.

Open
#223 20 comments 0 reactions 0 assignees View on GitHub
ext/io status/need-test
Dominant language
C++
Stars
199
Forks
171
Avg merge
1d 14h
Merged PRs (30d)
10

Description

When writing a gray16 PNG image, none error will arise at compile time or runtime, and the resulting image on disk will have all pixels with a value of '0'.

The following code reproduces the bug:

#include
#include
#include

namespace bg = boost::gil;

int main(int argc, char *argv[])
{
auto img = bg::gray16_image_t {10, 20, bg::gray16_pixel_t {0}};
auto view = bg::view(img);
auto count = std::uint16_t {0};
for (auto it = view.begin(); it != view.end(); ++it)
{
*it = count++;
}

bg::write_view("img.png", bg::const_view(img), bg::png_tag());
return 0;
}

When changing the image/view types to gray8 on code above, a correct image is wrote.

The used system is an up to date ArchLinux with gcc 8.2.1, boost 1.69, libpng 1.6.36.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.