How to install pyscreenshot on Linux – Python

Hello, Coders! In this Python tutorial, we will learn how to install pyscreenshot module on a Linux System.

Pyscreenshot Module in Python

Pyscreenshot is a module of python which is used to take screenshots without installing any third-party libraries.

It is very useful for Linux distros, though it is cross-platform. It copies the contents of the screen to a PIL or Pillow(Imaging Library) image memory using various back-ends. It’s also described as the replacement for the ImageGrab Module.

It supports python versions like 2.7,3.4 and 3.5 etc.

Installing pyscreenshot on a Linux System

Step1:Open the terminal emulator by pressing Ctrl+Alt+T.

Step2: Install pip, which is a package installer for python. (Like apt-get you can install by using pacman, rpm, dnf, dpkg, etc package manager as well for different distros)

sudo apt-get install python-pip

How to install pyscreenshot on Linux

Step3: We need to install the  PIL or Pillow imaging library for python before installing pyscreenshot.

sudo apt-get install python-pil

Python pil linux

Step4: Now install the pyscreenshot module by using the pip package manager.

sudo pip install pyscreenshot

sudo pip install pyscreenshot

Step5: Let’s verify the installation of pyscreenshot by doing a simple program.

import pyscreenshot
 
image = pyscreenshot.grab(bbox=(10, 10, 500, 500))
  
image.show() //show() function works as print. It displayed the captured screenshot.

image.save("CodeSpeedy.png")

Output:

pyscreenshot verify

Hope you enjoy learning this section and learned how to install pyscrrenshot module on a Linux system.

Happy Coding!!!

You can also read, How to install Python on Linux – Step-by-Step Guide

Leave a Reply

Your email address will not be published. Required fields are marked *