8000 Merge pull request #7796 from AdamWill/png-swap-endian · matplotlib/matplotlib@26567b3 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 26567b3

Browse files
committed
Merge pull request #7796 from AdamWill/png-swap-endian
Only byte-swap 16-bit PNGs on little-endian (#7792)
1 parent bffe631 commit 26567b3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/_png.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,12 @@ static PyObject *_read_png(PyObject *filein, bool float_result)
462462
png_set_shift(png_ptr, sig_bit);
463463
}
464464

465+
#if NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
465466
// Convert big endian to little
466467
if (bit_depth == 16) {
467468
png_set_swap(png_ptr);
468469
}
470+
#endif
469471

470472
// Convert palletes to full RGB
471473
if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) {

0 commit comments

Comments
 (0)
0