diff --git a/src/superqt/utils/_img_utils.py b/src/superqt/utils/_img_utils.py index d5a920dc..c82ae089 100644 --- a/src/superqt/utils/_img_utils.py +++ b/src/superqt/utils/_img_utils.py @@ -1,3 +1,4 @@ +import sys from typing import TYPE_CHECKING from qtpy.QtGui import QImage @@ -37,4 +38,8 @@ def qimage_to_array(img: QImage) -> "np.ndarray": arr = np.frombuffer(b, np.uint8).reshape(h, w, c) # reverse channel colors for numpy - return arr.take([2, 1, 0, 3], axis=2) + # On big endian we need to specify a different order + if sys.byteorder == "big": + return arr.take([1, 2, 3, 0], axis=2) # pragma: no cover + else: + return arr.take([2, 1, 0, 3], axis=2)