Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f57dddc

Browse files
committed
Do not assume < 8-bit images are 8-bit.
1 parent 012747b commit f57dddc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/_png.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ _png_module::read_png(const Py::Tuple& args)
429429
int num_dims = (png_get_color_type(png_ptr, info_ptr)
430430
& PNG_COLOR_MASK_COLOR) ? 3 : 2;
431431

432-
double max_value = (1 << ((bit_depth < 8) ? 8 : bit_depth)) - 1;
432+
double max_value = (1 << bit_depth) - 1;
433433
PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNew(
434434
num_dims, dimensions, PyArray_FLOAT);
435435

0 commit comments

Comments
 (0)