pillow

Why does PIL fail to merge 2 images in my code?

喜夏-厌秋 提交于 2019-12-31 07:10:41
问题 I am trying to combine 2 images into a larger one with Image.paste function. I start by creating an image that can hold both images, and then paste in the 2 images: wrapper = Image.new("I", (width, height+textHeight)); if placement=="bottom": wrapper.paste(img1); wrapper.paste(textImage, (0, height, width, textHeight)); else: wrapper.paste(textImage); wrapper.paste(img1, (0,textHeight)); Then I get this error every time: File "C:\Python27\lib\site-packages\PIL\Image.py", line 1127, in paste

Python3 PIL Pillow Ubuntu Install

那年仲夏 提交于 2019-12-31 02:43:14
问题 I'm running Ubuntu 14.04 LTS. I have both Python 2.7 and Python 3.4 installed. I'm relatively novice when it comes to installing Python Packages in Linux. I'm just trying to install and get access to PIL's image library in Python 3.4. It is my understanding that this is achieved by installing Pillow, the modern fork of PIL. It seems in my floundering I managed to successfully get PIL working in Python 2.7, but I still cannot get it working in 3.4. I got pip and pip3 . When I enter sudo pip3

Installing Pillow, getting -Wunused-command-line-argument-hard-error-in-future

狂风中的少年 提交于 2019-12-31 02:20:12
问题 I cannot get pillow installed. (env)noah:cupalensic2 broinjc$ which cc /usr/bin/cc (env)noah:cupalensic2 broinjc$ cc --version Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix I ran pip install mezzanine and when it got to satisfying pillow it screwed up... cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict

How to get an array from RGB values of a bitmap image?

懵懂的女人 提交于 2019-12-30 23:59:14
问题 I am running this code from PIL import Image import numpy as np im = Image.open("/Users/Hugo/green_leaves.jpg") im.load() height, widht = im.size p = np.array([0,0,0]) for row in range(height): for col in range(widht): a = im.getpixel((row,col)) p = np.append(a.asarray()) But I am getting the following error Traceback (most recent call last): File "/Users/hugo/PycharmProjects/Meteo API/image.py", line 17, in <module> p = np.append(a.asarray()) AttributeError: 'tuple' object has no attribute

How to create image from a list of pixel values in Python3?

流过昼夜 提交于 2019-12-30 10:45:16
问题 If I have a list of pixel rows from an image in the following format, how would get the image? [ [(54, 54, 54), (232, 23, 93), (71, 71, 71), (168, 167, 167)], [(204, 82, 122), (54, 54, 54), (168, 167, 167), (232, 23, 93)], [(71, 71, 71), (168, 167, 167), (54, 54, 54), (204, 82, 122)], [(168, 167, 167), (204, 82, 122), (232, 23, 93), (54, 54, 54)] ] 回答1: PIL and numpy are your friends here: from PIL import Image import numpy as np pixels = [ [(54, 54, 54), (232, 23, 93), (71, 71, 71), (168,

Error installing Pillow (and PIL)

北城以北 提交于 2019-12-30 07:23:09
问题 If i use the command sudo pip install Pillow , it runs fine until the cleaning up stage: (this is the full error message from the log file) clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'cc' failed with exit status 1 ---------------------------------------- Cleaning up... Removing temporary dir /private/tmp/pip_build_root... Command

cannot import name 'ImageTK' - python 3.5

余生长醉 提交于 2019-12-30 05:57:14
问题 I am trying to load in an image from the same folder as the one my python script is in. # create a class called Person # create init method # 2 attributes (name, and birthdate) # create an object from the Person class from PIL import Image, ImageTK import datetime import tkinter as tk # create frame window = tk.Tk() # create frame geometry window.geometry("400x400") # set title of frame window.title("Age Calculator App") # adding labels name_label = tk.Label(text="Name") name_label.grid

py2app TypeError: dyld_find() got an unexpected keyword argument 'loader'

若如初见. 提交于 2019-12-29 06:55:34
问题 I'm having difficulty building my app using py2app. I can build it in alias mode without issue using this command: python3.4 setup.py py2app -A However when I try and build it using: python3.4 setup.py py2app I get the error message as per title of this post. From the research I've done I believe it's an issue with Pillow; however I need Pillow for this app. (Unless there's another module I can use to import images??). I've also tried cx_freeze without success. Any help or direction much

Copy PIL/PILLOW Image to Windows Clipboard

ぃ、小莉子 提交于 2019-12-29 01:49:07
问题 I've seen this question and i followed every step, changing the code to satisfy my requirements, that are Python3, Pillow, and ctypes. The less libraries, the better. import ctypes from PIL import ImageGrab, Image from io import BytesIO user32 = ctypes.windll.user32 img = ImageGrab.grab() output = BytesIO() img.convert("RGB").save(output, "BMP") data = output.getvalue()[14:] output.close() user32.OpenClipboard() user32.EmptyClipboard() user32.SetClipboardData(user32.CF_DIB, data) user32

Package (Python PIL/Pillow) installed but I can't import it

我怕爱的太早我们不能终老 提交于 2019-12-28 16:07:05
问题 I've been using python for simple data processing scripts, but now I want to do some image processing and I encountered a problem. Importing the pillow module doesn't seem to work. I found a simple script here to check what packages are installed and I found it, but importing it doesn't seem to work. Here's the code I'm trying to run: import pip installed_packages = pip.get_installed_distributions() installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages])