I have an image where the colors are BGR. How can I transform my PIL image to swap the B and R elements of each pixel in an efficient manner?
Adding a solution using the ellipsis
image = image[...,::-1]
In this case, the ellipsis ... is equivalent to :,: while ::-1 inverts the order of the last dimension (channels).
...
:,:
::-1