I have a Problem with the Pillow module.
So basically i tried the methods on this website installing it per pip install Pillow and also importing it per from PIL import Image and import PIL none of them worked
I would really appreciate it if someone helped
and thanks for reading. This is my code:
import pyautogui
import pyscreeze
from PIL import Image
lkchat = pyautogui.locateCenterOnScreen("python.png")
print ("lkchat")
I'm getting the following error message:
from PIL import Image
ImportError: No module named PIL
Kitty Star i would like to suggest you that replace PIL with pillow and then install pillow if your code does not run let me know the next error.
Related
I downloaded Pillow using pip and am trying to import its Image package to use the rotate function that is in the Image package, but when I use
from PIL import Image
I get an
Unused import: Image
error along with a
found at PIL.Image 1
message. Does anybody know what this means or what I'm doing wrong?
I am trying to import image to python but end up getting the same error again and again.
I have tried most of the solutions mentioned about this problem on multiple discussion threads but none of them have solved this issue of mine.
I have installed Pillow but still the error prevails. Would really appreciate some guidance on how to resolve this issue.
from scipy.misc import imread, imresize, imsave
import numpy as np
ImportError Traceback (most recent call last)
<ipython-input-6-c8bc16b68368> in <module>
----> 1 from scipy.misc import imread, imresize, imsave
2 import numpy as np
ImportError: cannot import name 'imread'
The library you're looking scipy.misc.imread is deprecated. You can use imageio. First install Pillow and then install imageio
pip install Pillow imageio
Then you can use,
imageio.imread('image1.png')
imageio.imread('image2.png', array)
But you cannot resize in imageio. Use numpy for that.
What is your version? I think scipy.misc.imread is deprecated. Use imageio
import imageio
image = imageio.imread('pic.png')
I'm working through a tutorial and the code is:
import numpy as np
from scipy import misc
from skimage import data
photo_data = misc.imread('foo.jpg')
This didn't work and stack overflow searches suggested I needed to install scikit-image. I installed it, but that still didn't work. More searching said I also need to install Pillow. Installed Pillow and that still didn't work.
More searching suggested I needed to write the code as:
import scipy.misc
from scipy.misc.pilutil import imread
No error from that (!) but then the code I to read in the photo doesn't work:
photo_data=misc.imread('foo.jpg')
error: module.scipy.misc has no attribute imread
if I try:
photo_data = misc.pilutil.imread('foo.jpg')
error is very ugly and talks about imread being deprecated and the errors are a LOT more complicated.
Is there is simple way to read this photo in?
Thanks.
Python 3.6.4
Pillow (PIL) 5.0
OS Win 7
pyscreeze 0.1.13
I'm trying to utilize the screenshot functions with pyautogui, but encountering an issue.
import pyautogui
image = pyautogui.locateOnScreen('imagepath')
print(image)
I'm receiving the following error:
File "C:\Users\a7153\AppData\Local\Programs\Python\Python36\lib\site-packages\pyscreeze__init__.py", line 315, in _screenshot_win32
im = ImageGrab.grab()
NameError: name 'ImageGrab' is not defined
I've tried going to pyscreeze and directly importing from PIL (pillow) import ImageGrab, but with no luck. I've gone through the documentation and there doesn't seem to be anything on the issue. Does anyone have any suggestions?
Although this is a reasonably well documented problem, I can't find a solution.
I cannot import PIL and ImageTK.
Minimal example:
import Tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
image = Image.open('live.ppm')
photo = ImageTk.PhotoImage(image)
This produces the error:
File "C:\Anaconda\lib\site-packages\PIL\ImageTk.py", line 181, in paste
import _imagingtk
ImportError: No module named _imagingtk
I have tried:
conda install pillow
conda remove PIL
But no luck.
After uninstalling pillow and PIL:
pip install image
Fixed this issue.
Thanks for bringing this up. The ImageTk module is an extra extension that is not part of the default installation of Pillow.
This issue is long-standing: https://github.com/ContinuumIO/anaconda-issues/issues/150
We (Continuum) will investigate adding this module to our build process.
Try to verify the extension of the image, i got the same problem, and when i modified the extension the script worked