I want to flip an image (with three channels RGB) horizontally just using array slicing. How can I do it with python?

28 views Asked by At

I appreciate it if you can provide me with one-line code.

I used np.flip but I want a different approach to make it generalized. This was my code: np.flip(image, 1) I also used np.fliplr(image).

Note: The image to be flipped has three channels.

1

There are 1 answers

0
Gabriel Wolf On BEST ANSWER

flipped_image = image[:, ::-1, :]