I want to execute this code in Pycharm
x, y = pyautogui.locateCenterOnScreen('LVL35.png')
But I get this message
ImportError: Pillow module must be installed to use screenshot functions on Windows.
The thing is, I use anaconda and Pillow is already installed and I can also find it in the Project Interpreter settings.
Requirement already satisfied: Pillow in c:\anaconda3\lib\site-packages (4.2.1)
Any idea?
To load the image, we simply import the image module from the pillow and call the Image. open(), passing the image filename. Instead of calling the Pillow module, we will call the PIL module as to make it backward compatible with an older module called Python Imaging Library (PIL).
PyScreeze is a simple, cross-platform screenshot module for Python 2 and 3.
Code For Screenshot Using PyAutoGUI 1 First of all import pyautogui module. 2 Then create a variable (file) that will store the screenshot. 3 screenshot ( ) method will take screenshot of your screen. 4 Now save this image by calling save ( ) method. You have to pass name of screenshot to the save ( ) function.
To install PyAutoGUI module, you have to run following code on your command prompt. screenshot ( ) method of pyautogui class is used to take screenshot of your screen. Now write the following code on your python IDE.
ImportError: Pillow module must be installed to use screenshot functions on Windows. The thing is, I use anaconda and Pillow is already installed and I can also find it in the Project Interpreter settings. Any idea? What's OS you are using Linux /Windows , For Linux you need to have scrot installed , For windows there is no dependency .
In this tutorial, we will introduce using python pillow library to take a screenshot for python beginners. We will use ImageGrab model to take a screenshot. In this tutorial, we will take a image 250 * 250. In order to set bbox correctly, you can read this tutorial. We will use ImageGrab.grab () function to get a snapshot of the screen.
That's almost a bit embarassing, but in case anyone of you has the same problem, just update your Pillow package.
pip install Pillow --upgrade
Pillow-4.2.1 was on my system, it upgraded to Pillow-5.1.0 and now everything works just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With