pil

python imaging library draw text new line how to?

i have a word that will be putted on a image but the problem is that the word continues even though the word exceeds the width of the image is there anyway that the word shift's down if the word exceeds the width of the image or on a certain point the word shift's down if it exceeds the given point ...

how to fill a part of a circle using PIL?

hello. I'm trying to use PIL for a task but the result is very dirty. What I'm doing is trying to fill a part of a piece of a circle, as you can see on the image. Here is my code: def gen_image(values): side = 568 margin = 47 image = Image.open(settings.MEDIA_ROOT + "/i/promo_circle.jpg") draw = ImageDraw.Draw(image...

gcc error trying to install PIL in a Python2.6 virtualenv

I have created a virtualenv with the --no-site-packages option. I get an error trying to install PIL: http://pastebin.com/SVqxs1sC ... error: command '/usr/bin/gcc' failed with exit status 1 ---------------------------------------- Command /home/dustin/.virtualenvs/django1.2/bin/python -c "import setuptools; __file__='/home/dustin/.vi...

ImageChops.duplicate - python

Hi I am tring to use the function ImageChops.dulpicate from the PIL module and I get an error I don't understand: this is the code import PIL import Image import ImageChops import os PathDemo4a='C:/Documents and Settings/Ariel/My Documents/My Dropbox/lecture/demo4a' PathDemo4b='C:/Documents and Settings/Ariel/My Documents/My Dropbox...

draw circle PIL - python

Hi I am looking for a command that will draw a circle on an existing image. im=Image.open(path) looking for a function that will draw a coloured circle with radious r and center(x,y) thanks for any help provided Ariel ...

Using Pycairo to generate images dynamically and serve in Django

I want to generate a dynamically created png image with Pycairo and serve it usign Django. I read this: http://stackoverflow.com/questions/1074200/serve-a-dynamically-generated-image-with-django. Is there a way to transport data from Pycairo surface directly into HTTP response? I'm doing this for now: data = surface.to_rgba() im = Imag...

Python Library installation

Hi everybody I have two questions regarding python libraries: I would like to know if there is something like a "super" python library which lets me install ALL or at least all scientific useful python libraries, which I can install once and then I have all I need. There is a number of annoying problems when installing different libra...

PIL's Image.show() brings up *two* different viewers

When toying with images in the python shell, I use image.show(), where image is an instance of Image. Long ago nothing happened, but after defining a symlink to mirage named "xv", I was happy. The last few days, show() will bring up both ImageMagick's display and also Mirage. It's not clear where show() gets information on what to run...

Bug when drawing a QImage on a widget with PIL and PyQt

I'm trying to write a small graphic application, and I need to construct some image using PIL that I show in a widget. The image is correctly constructed (I can check with im.show()), I can convert it to a QImage, that I can save normally to disk (using QImage.save), but if I try to draw it directly on my QWidget, it only show a white sq...

Tkinter using a non-saved picture as an image

I'm trying to grab a screenshot every 30 seconds and display it on my GUI, heres what I've got so far. Code: from Tkinter import * from PIL import ImageGrab window = Tk() box = (100,100,400,400) MyImage = ImageGrab.grab(box) MyPhotoImage = PhotoImage(file=MyImage) #I know this is where its going wrong, just not sure how to fix it Pi...

Doing the same as ImageMagick's "-level" in python / PIL ?

I want to adjust the colour levels of an image in python. I can use any python library that can easily be installed on my Ubuntu desktop. I want to do the same as ImageMagick's -level ( http://www.imagemagick.org/www/command-line-options.html#level ). PIL (Python Image Library) doesn't seem to have it. I have been calling convert on the ...

PIL with Python 2.6.5 on Snow Leopard Install Issues

Hi, I am at wit's end. I have a working install of python 2.6.5 with numpy and scipy. I want to use it to do some simple PCA which requires importing images. Well, I figured PIL was the way to go for this. So, following a guide, I downloaded and installed libjpeg6-b. I then used the following commands tar zxvf jpegsrc.v6b.tar.gz cd jpe...

Drawing an anti-aliased line with thePython Imaging Library

I'm drawing a bunch of lines with the Python Imaging Library's ImageDraw.line(), but they look horrid since I can't find a way to anti-alias them. How can I anti-alias lines in PIL? If PIL can't do it, is there another Python image manipulation library that can? ...

How to Close an Image?

I'm trying to take an image file, do some stuff to it and save the changes back to the original file. The problem I'm having is in overwriting the original image; there doesn't seem to be a reliable way to release the handle on filename. I need this content to be saved back to the same file because external processes depend on that fil...

Replacing a single color in PIL?

I have an Image, I'd like to replace all the pixels of one color with those in a different color, what is the simplest way to go about that? More or less I have an image in tkinter, and when a button is pressed I want the color to change. ...

Python PIL ImageTk.PhotoImage() is giving me a bus error?

So I am running python 2.6 on a macbook pro and trying to write the code in python to display an image from a file in a label on a tkinter gui. The image is called image.png. The program runs without errors when I use this code i = Image.open("image.png") but when I do this code (I add one line): i = Image.open("image.png") photo = ...

How to add Tkinter support for PIL Python library

Okay, well supposedly PIL is supposed to be able to work with Tkinter automatically, but mine is not. I found this text file in the Imaging directories Tk directory. Using PIL With Tkinter Starting with 1.0 final (release candidate 2 and later, to be precise), PIL can attach itself to Tkinter in flight. As a result, you no longer ne...

Using Python Image Library with VirtualEnv on Windows.

I'm attempting to install the PIL library in an Virtual Enviroment that I have created. Usually to install PIL I'd grab the install, however this won't allow me to choose my virtualenv only my root Python folder (C:/Python26). I tried both pip install PIL and easy_install PIP but they didn't work. I've also tried downloading the TAR, e...

Installing PIL on Snow Leopard -- NOTHING WORKS

I'm trying to install PIL on Snow Leopard, using Python 2.6.1, GCC 4.2.1, PIL 1.1.7, and have tried with both libjpeg6b and libjpeg7 -- nothing works. I've cleared out every trace of libjpeg/pil/zlib from fink, tried various compiler options, etc. and used http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/ and http:// www....

Using PIL and NumPy to convert an image to Lab array, modify the values and then convert back

I am trying to convert a PIL image into an array using NumPy. I then want to convert that array into Lab values, modify the values and then convert the array back in to an image and save the image. I have the following code: import Image, color, numpy # Open the image file src = Image.open("face-him.jpg") # Attempt to ensure image is ...