Load 16bit PNG images correctly by re-scaling to 8bit

Fixes #1110
pull/1182/head
ruevs 2022-01-06 14:58:33 +02:00
parent 892477ee43
commit 3136493a6a
1 changed files with 2 additions and 1 deletions

View File

@ -179,7 +179,8 @@ void Pixmap::ConvertTo(Format newFormat) {
static std::shared_ptr<Pixmap> ReadPngIntoPixmap(png_struct *png_ptr, png_info *info_ptr, static std::shared_ptr<Pixmap> ReadPngIntoPixmap(png_struct *png_ptr, png_info *info_ptr,
bool flip) { bool flip) {
png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_EXPAND | PNG_TRANSFORM_GRAY_TO_RGB, NULL); png_read_png(png_ptr, info_ptr,
PNG_TRANSFORM_EXPAND | PNG_TRANSFORM_GRAY_TO_RGB | PNG_TRANSFORM_SCALE_16, NULL);
std::shared_ptr<Pixmap> pixmap = std::make_shared<Pixmap>(); std::shared_ptr<Pixmap> pixmap = std::make_shared<Pixmap>();
pixmap->width = png_get_image_width(png_ptr, info_ptr); pixmap->width = png_get_image_width(png_ptr, info_ptr);