image_testing.py: swap red and blue channels

This commit is contained in:
KIU Shueng Chuan 2021-03-30 09:11:43 +08:00
parent 4dc76ed90e
commit 179b27ad8c

View File

@ -145,8 +145,13 @@ def assertImageApproved(image, standardFile, message=None, **kwargs):
image = fn.imageToArray(qimg, copy=False, transpose=False) image = fn.imageToArray(qimg, copy=False, transpose=False)
# transpose BGRA to RGBA # the standard images seem to have their Red and Blue swapped
image = image[..., [2, 1, 0, 3]] if sys.byteorder == 'little':
# transpose B,G,R,A to R,G,B,A
image = image[..., [2, 1, 0, 3]]
else:
# transpose A,R,G,B to A,B,G,R
image = image[..., [0, 3, 2, 1]]
if message is None: if message is None:
code = inspect.currentframe().f_back.f_code code = inspect.currentframe().f_back.f_code