pillow

Pillow virtualenv install fails: “command 'gcc-4.2' failed” [duplicate]

感情迁移 提交于 2019-12-11 13:05:20
问题 This question already has answers here : gcc-4.2 failed with exit status 1 (8 answers) Closed 5 years ago . I am installing Mezzanine in a virtualenv. It fails at the Pillow installation with a gcc-4.2 related error of which this is an excerpt. I can actually install it successfully on my machine but not inside of a virtualenv. I want it in a venv however. What should I do? `decode.c:465: error: ‘COMPRESSION_SGILOG’ undeclared (first use in this function) decode.c:468: error: ‘COMPRESSION

Pillow recognizes JPEG encoder on install, but not use

五迷三道 提交于 2019-12-11 12:11:51
问题 I'm doing some work on a vagrant box running Ubuntu 13.04 and python 3.3. I've installed Pillow and libjpeg-dev (installing the latter first, as recommended), and when I install (or re-install Pillow, I see this: -------------------------------------------------------------------- PIL SETUP SUMMARY -------------------------------------------------------------------- version Pillow 2.3.0 platform linux 3.3.1 (default, Sep 25 2013, 19:29:01) [GCC 4.7.3] -----------------------------------------

Unable to delete file - File being used by another process

安稳与你 提交于 2019-12-11 12:04:15
问题 I currently use the Pillow (and windows) lib to convert 2 types of files to jpeg. The problem is I create a tmp file to alter (crop/re-size/rotate/etc) but afterwords I cannot delete it. If the file is X type it can be deleted, if is not X type it will give an error. The process is the same on both file types yet I do get an error on deleting a file which is no X type. Already trying forcing fout.close() even though "with" statement does it by default. If I set a try/except statement on the I

Python/Django png,gif to jpg

随声附和 提交于 2019-12-11 11:20:06
问题 i'm using Django 1.6.2 and Python 3.3.5 and Pillow 2.3.0. What is the best way to convert an png/gif image to an jpg image in Django, so that the output-file is nearly the same as the uploaded file? (transparency => white) I have tried a couple of solutions like: import Image im = Image.open("infile.png") im.save("outfile.jpg") or from PIL import Image im = Image.open("file.png") bg = Image.new("RGB", im.size, (255,255,255)) bg.paste(im,im) bg.save("file.jpg") The problem is i found no

How to insert an image into a button?

こ雲淡風輕ζ 提交于 2019-12-11 08:47:01
问题 I'm executing the following code import tkinter import tkinter.messagebox import random from PIL import Image item = tkinter.Button(root, text=color, width=20, height=10, relief='raised', borderwidth=5, bg=color ) original = Image.open('images/img1.gif') ph_im = Image.PhotoImage(original) item.config(image=ph_im) item.pack(side='left') I am using Pillow for Python33. I'm trying to insert an image into a button, but returns this error message: Traceback (most recent call last): File "C:

Count different colour pixels - Python

放肆的年华 提交于 2019-12-11 08:26:16
问题 I found this code on here but all it does is count black and red, and this would only work with a black and red image. from PIL import Image im = Image.open('oh.png') black = 0 red = 0 for pixel in im.getdata(): if pixel == (0, 0, 0, 255): # if your image is RGB (if RGBA, (0, 0, 0, 255) or so black += 1 else: red += 1 print('black=' + str(black)+', red='+str(red)) How would I be able to check different colours and not have it so precise, for example black could be (0, 0, 0) to (40,40,40).

pillow image TypeError: an integer is required (got type tuple)

孤街浪徒 提交于 2019-12-11 04:53:25
问题 I am a bit lost as to why this is happening any help would be greatly appreciated. So I am trying to take the median value of images and create a new image from them, but when trying to make newpix take in the values of my red green and blue median pixel the error: TypeError: an integer is required (got type tuple) happens from PIL import Image, ImageChops,ImageDraw,ImageFilter import math import glob import os.path from os import listdir; import numpy image_list = [] redPixels = []

Convert tiff (I;16) to JPG with PIL/pillow

本小妞迷上赌 提交于 2019-12-11 04:27:08
问题 I have a problem converting a tiff image from a microscope to a jpeg, which should be shown within a web application. I tried the following: image = Image.open(file_name) image.convert(mode="RGB") image.save('my.jpeg') >>IOError: cannot write mode I;16 as JPEG Anybody has some experience in converting 16-bit TIFF files to jpegs... I have linked such a file below. Thanks for your help! https://drive.google.com/open?id=0B04N02JqhWJOWjBPY1RRZkIwbTg 回答1: It's either a bug or unimplemented in PIL

Installing Pillow and PIL

感情迁移 提交于 2019-12-11 04:05:11
问题 I have Ubuntu 12.04 (Precise Pangolin) installed and some package installed, PIL. Now I want to use Pillow, but that cannot be installed at the same time as PIL. I looked at virtualenv, but there are other packages I don't want to have to install. Is there another way to set this up without the clash? 回答1: You should install Pillow from the Git clone with (choose /opt/pillow as you want): python setup.py install --prefix /opt/pillow And then it include in your code, import sys sys.path.insert

How to install Pillow on Python 3.5?

会有一股神秘感。 提交于 2019-12-11 03:45:25
问题 As the title suggested I have trouble installing Pillow on Python 3.5.2. I believe I already have pip and easyinstall preinstalled. I have viewed some tutorials and attempted to type '>$pip install Pillow' into the IDLE shell but it came back with a syntax error. I am new to programming and have no prior IT exprience so please be specific and put it in simple terms. My OS is Windows 10. Thanks. 回答1: sudo pip3 install Pillow - unix-style pip install Pillow - windows http://pillow.readthedocs