Hmmm. I think I know where the issues is from your code explanation, but don’t know how to solve it yet.
The type of the mask is ‘bool’ should be a list of ‘bool’; like in your
x = [True, False]
but in my case it’s just a ‘bool’.
I have an error when I tried to get the size with .size:

AttributeError: ‘bool’ object has no attribute ‘size’

and that is true as the type is bool and not a list.
I printed the image with pyplot as seen in the image below.error_image11234×1132 70.2 KB