How to flip an image horizontally or vertically in Python? Last Updated : 25 May, 2021 Comments Improve Suggest changes Like Article Like Report Prerequisites: PIL Given an image the task here is to generate a Python script to flip an image horizontally and vertically. Here the module used for the task is PIL and transpose() function of this module. Syntax: transpose(degree) Keywords FLIP_TOP_BOTTOM and FLIP_LEFT_RIGHT will be passed to transpose method to flip it. FLIP_TOP_BOTTOM - returns an original image flipped VerticallyFLIP_LEFT_RIGHT- returns an original image flipped HorizontallyApproachImport moduleOpen original imageTransform the image as requiredSave the new transformed image. Image in use: Example: Flipping image vertically Python3 # importing PIL Module from PIL import Image # open the original image original_img = Image.open("original.png") # Flip the original image vertically vertical_img = original_img.transpose(method=Image.FLIP_TOP_BOTTOM) vertical_img.save("vertical.png") # close all our files object original_img.close() vertical_img.close() Output: Example : Flip image horizontally Python3 # importing PIL Module from PIL import Image # open the original image original_img = Image.open("original.png") # Flip the original image horizontally horz_img = original_img.transpose(method=Image.FLIP_LEFT_RIGHT) horz_img.save("horizontal.png") # close all our files object original_img.close() horz_img.close() Output: Comment More infoAdvertise with us Next Article How to flip an image horizontally or vertically in Python? A ashgr Follow Improve Article Tags : Python Python-pil Practice Tags : python Similar Reads How to Flip or Mirror an Image in Google Docs How to Flip an Image in Google Docs - Quick Steps Go to Insert > Drawing > New to upload an image.In the Drawing tool, click on the image to select it.Click on Actions in the menu.Choose Rotate, then select either Flip horizontally or Flip vertically.Flipping or mirroring an image in Google Do 6 min read How to Concatenate image using Pillow in Python ? Prerequisites: Python Pillow Concatenate image means joining of two images. We can merge any image whether it has different pixels, different image formats namely, 'jpeg', 'png', 'gif', 'tiff', etc. In python, we can join two images using the Python image library also known as the pillow library. In 3 min read How to find width and height of an image using Python? Finding the width and height of an image in Python means reading the image and determining its dimensions in pixels. For example an image might have a height of 135 pixels and a width of 600 pixels. Letâs explore some common methods to find an imageâs width and height.1. Using OpenCV (cv2)OpenCV is 2 min read How to Display an OpenCV image in Python with Matplotlib? The OpenCV module is an open-source computer vision and machine learning software library. It is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and vide 2 min read How to rotate an image by an angle using PyTorch in Python? In this article, we are going to see how to rotate an image by an angle in PyTorch. To achieve this, we can use RandomRotation() method. RandomRotation() transform accepts both PIL and tensor images. A Tensor Image is a tensor with (C, H, W) shape, C is for the number of channels, H and W are for th 2 min read Like