pillow

Pyinstaller with PIL. ImportError: cannot import name _imaging

孤者浪人 提交于 2019-12-24 05:13:28
问题 I am having trouble running a compiled executable that includes pillow. I have used pyinstaller which seems to compile well enough, however after running the exe, an error is thrown. Seems there is a conflict with '_imaging' being referenced instead of 'Image'. First off, I find it strange how pillow installs to a PIL directory rather than a pillow and the modules are also referenced as PIL. I doubt that has anything to do with the problem though. There isn't actually a _imaging.py file in

pillow imaging ImportError

微笑、不失礼 提交于 2019-12-24 00:29:56
问题 I installed Pillow 3.0.0 by pip onto my Python3.5 on my 32bit windows7 PC. from PIL import Image gives me: File "C:\Python 3.5\lib\site-packages\PIL\Image.py", line 66, in <module> from PIL import _imaging as core ImportError: DLL load failed: The specified procedure could not be found. The Image file contains this comment: # If the _imaging C module is not present, Pillow will not load. The PIL directory contains no -imaging files. There was one called _imaging.cp35-win32.pyc but it has

How to improve text extraction from an image?

我的梦境 提交于 2019-12-23 17:35:52
问题 I am using pytesseract to extract text from images. Before extracting text with pytesseract, I use Pillow and cv2 to reduce noise and enhance the image: import numpy as np import pytesseract from PIL import Image, ImageFilter, ImageEnhance import cv2 img = cv2.imread('ss.png') img = cv2.resize(img, (0,0), fx=3, fy=3) cv2.imwrite("new.png", img) img1 = cv2.imread("new.png", 0) #Apply dilation and erosion kernel = np.ones((2, 2), np.uint8) img1 = cv2.dilate(img1, kernel, iterations=1) img1 =

Image deduction with Pillow and Numpy

假装没事ソ 提交于 2019-12-23 13:26:15
问题 I have two images: and I want to export an image that just has the red "Hello" like: So I am running a simple deduction python script: from PIL import Image import numpy as np root = '/root/' im1 = np.asarray(Image.open(root+'1.jpg')) im2 = np.asarray(Image.open(root+'2.jpg')) deducted_image = np.subtract(im1, im2) im = Image.fromarray(np.uint8(deducted_image)) im.save(root+"deduction.jpg") But this returns: rather than the above. What am I doing wrong? Also do I need numpy or can I do this

How do I properly set DPI when saving a pillow image?

无人久伴 提交于 2019-12-23 09:26:54
问题 I am trying to create images programatically on Python using Pillow library but I'm having problems with the image quality of the text inside the image. I want to save the Image the I generate to PNG, so I'm setting the DPI when saving according to this, but whether I save with dpi=(72,72) or dpi=(600,600) it visually looks the same. My code for doing it is the following: from PIL import Image, ImageDraw, ImageFont def generate_empty_canvas(width, height, color='white'): size = (width, height

Error trying to install libjpeg-devel with elastic beanstalk

不羁的心 提交于 2019-12-23 08:49:26
问题 I am trying to do some image resizing on my Django application running on AWS Elastic beanstalk, so I am trying to install Pillow to do the job. As described in some previous posts, I am adding packages: yum: libjpeg-devel: '6b' at the top of my .ebextension/myapp.config My requirement.txt includes: Django==1.6.7 boto>=2.32.1 django-filter>=0.7 django-password-reset>=0.7 django-storages>=1.1.8 django-taggit==0.12 djangorestframework>=2.3.13 django-bootstrap3>=4.11.0 django-bootstrap3

'Unknown extension' in save function of PIL due to empty EXTENSION array

て烟熏妆下的殇ゞ 提交于 2019-12-23 06:49:16
问题 I am rather new to python and have a problem with the save function of the Pillow fork of PIL. With this minimal example import Image im = Image.new("RGB", (200, 30), "#ddd") im.save("image.png") I get the following error: File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 1667, in save raise KeyError(ext) # unknown extension KeyError: '.png' The corresponding lines in the save function are preinit() [...] try: format = EXTENSION[ext] except KeyError: raise KeyError(ext) # unknown

Using Pillow to draw cursive text

孤人 提交于 2019-12-23 05:13:24
问题 I'm to draw text over an image in a Django application hosted on an Ubuntu 14.04 LTS machine. Pillow 4.2.1 is my lib of choice. I've successfully accomplished this task via ImageDraw imported from PIL (The actual code is at the end of this question) My code works perfectly for languages such as English, French or Spanish. But not for naturally cursive languages like Arabic, Persian or Urdu. In such cases, it draws each letter separately. E.g. فارسی (Persian) is drawn as: Note that I installed

Installing pillow on windows fails to find libjpeg

空扰寡人 提交于 2019-12-23 04:26:58
问题 Sys: Windows 7 Prof; Python v3.3 I've tried to use: 'easy_install Pillow' 'pip install use-wheel Pillow' Download package manually and 'python setup.py install' but all the time i cant install any extensions: *** TKINTER support not available (Tcl/Tk 8.5 libraries needed) *** JPEG not support available *** ZLIB (PNG/ZIP) support not available *** TIFF G3/G4 (experimental) support not available *** FREETYPE2 support not available *** LITTLECMS support not available *** WEBP support not

Python 3- pyautogui can't use screen shot functions

六眼飞鱼酱① 提交于 2019-12-23 01:04:18
问题 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