Finding the Size Resolution of Image in Python Last Updated : 03 Jan, 2023 Comments Improve Suggest changes Like Article Like Report Let us see how to find the resolution of an image in Python. We will be solving this problem with two different libraries which are present in Python: PILOpenCV In our examples we will be using the following image: The resolution of the above image is 600x135. Using PIL We will be using a library named Pillow to find the size(resolution) of the image. We will be using the function PIL.Image.open() to open and read our image and store the size in two variables by using the function img.size. Python3 # importing the module import PIL from PIL import Image # loading the image img = PIL.Image.open("geeksforgeeks.png") # fetching the dimensions wid, hgt = img.size # displaying the dimensions print(str(wid) + "x" + str(hgt)) Output: 600x135 Using OpenCV We will import OpenCV by importing the library cv2. We will load the image using the cv2.imread() function. After this, the dimensions can be found using the shape attribute. shape[0] will give us the height and shape[1] will give us the width. Python3 # importing the module import cv2 # loading the image img = cv2.imread("geeksforgeeks.png") # fetching the dimensions wid = img.shape[1] hgt = img.shape[0] # displaying the dimensions print(str(wid) + "x" + str(hgt)) Output: 600x135 Comment More infoAdvertise with us Next Article Finding the Size Resolution of Image in Python B br0wnhammer Follow Improve Article Tags : Python OpenCV Python-pil Python-OpenCV Practice Tags : python Similar Reads Change image resolution using Pillow in Python Prerequisites: Python pillow PIL is the Python Imaging Library which provides the python interpreter with an in-depth file format support, an efficient internal representation, and fairly powerful image processing capabilities. Changing the resolution of an image simply means reducing or increasing 2 min read Reading an image in OpenCV using Python Prerequisite: Basics of OpenCVIn this article, we'll try to open an image by using OpenCV (Open Source Computer Vision) library.  Following types of files are supported in OpenCV library:Windows bitmaps - *.bmp, *.dibJPEG files - *.jpeg, *.jpgPortable Network Graphics - *.png WebP - *.webp Sun raste 6 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 resize Image in Python - Tkinter? Python provides multiple options for building GUI (Graphical User Interface) applications. Among them, Tkinter is one of the most widely used and simplest options. It comes bundled with Python and serves as a standard interface to the Tk GUI toolkit.However, Tkinter alone does not provide support fo 2 min read How to change video resolution in OpenCV in Python In this article, we will describe how you can capture each frame from the video and also resize them according to your needs. What we will exactly do is take the video as input from the user and capture it frame by frame. Moreover, we run the video in the loop and save the image frames with certain 3 min read Like