pil

create a grayscale image

Hi all, I am reading binary data from one file that specifies intensity values across x and y coordinates (not a open-source image format) and want to convert it to a PNG image (or other widely supported format). I have the data loaded into an array (using the array module) where each element is a integer from 0 to 255. To save this to ...

Python# screenshot failure

I am using PIL(Python Imaging Library) for grabbing the image. But grabber() throws the following error message if I minimized the window img=ImageGrab.grab() File "C:\Python26\lib\site-packages\PIL\ImageGrab.py", line 47, in grab size, data = grabber() IOError: screen grab failed My browser shot factory is installed in a Win 2003...

Having "Exception Value: The _imaging C module is not installed" with my Buildout/Python/Django/PIL on Mac OSX SL?

Hello there. I'm using Buildout for my Django projects, with FeinCMS. I've got it setup great locally on my Mac OSX Snow Leopard, with no errors coming up at all when I use runserver. But when I upload an image with FeinCMS in the admin area it comes up with a "Exception Value: The _imaging C module is not installed" error. My tracebac...

Problems using PIL 1.1.7

The trivial import Image im = Image.OPEN('C:\abc.bmp') results in the following exception Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> im = Image.OPEN('C:\Documents and Settings\umair.ahmed\My Documents\My Pictures\avanza.bmp') TypeError: 'dict' object is not callable not sure if i am missing so...

Is it possible to control which libraries apache uses?

Okay, so I had an earlier problem with PIL that is still unresolved. Someone else had this problem and had success by removing the old JPEG library. I can't really do that on my machine, however, as it's RHEL and so many things are dependent on libjpeg and libjpeg-devel (when I tried yum remove libjpeg just to see, there were a total of ...

Using the Image.point() method in PIL to manipulate pixel data

I am using the Python Imaging Library to colorize a black and white image with a lookup table that defines the color relationships. The lookup table is simply a 256-element list of RGB tuples: >>> len(colors) 256 >>> colors[0] (255, 237, 237) >>> colors[127] (50, 196, 33) >>> My first version used the getpixel() and putpixel() met...

how Install the FreeType dev files

I asked a python questinom, got this answer: Sounds like PIL was built without FreeType support. Install the FreeType dev files and rebuild PIL again. since I didn't find a way to reply to messages in this forum, I am raising another question. how to do what i was answered to do? -Install the FreeType dev files ? thanks ...

ReportLab and Python Imaging Library images from memory issue

I've run into an issue I can't seem to figure out with PIL and reportlab. Specifically, I would like to use drawImage on a canvas in reportlab using a PIL Image object. In the past I've inserted images into reportlab documents from the web using raw data, StringIO and reportlab's ImageReader class. Unfortunately, ImageReader takes a fil...

Does Python PIL resize maintain the aspect ratio?

Edit: Does PIL resize to the exact dimensions I give it no matter what? Or will it try to keep the aspect ratio if I give it something like the Image.ANTIALIAS argument? ...

draw text to center of the image using PIL

hi I have a few stings I would like to draw to imagea. the thing is that I want each string to be displayed in the middle of each image. how do I do it? or how can I know the length in pixels of a string (giving ofcourse the font)? thanks ...

Extending a PIL decoder

I have a file which contains a single image of a specific format at a specific offset. I can already get a file-like for the embedded image which supports read(), seek(), and tell(). I want to take advantage of an existing PIL decoder to handle the embedded image, but be able to treat the entire file as an "image file" in its own right. ...

Python: Animation with PIL

I want an animated picture. But I need a refresh-function because plt.show() always opens a new window. Does anybody have a hint? Thanks! import numpy as np import scipy from scipy import * import matplotlib.pyplot as plt #array aa = [] for x in range(44): aa.append([]) for z in range(44): aa[x].append(3*sin(x/3.0)+2*co...

Trouble using PIL with Google Appengine SDK

I have a Windows Server 2008 R2 (64bits) machine on which I wanted to develop a google AppEngine app. So I installed Python 2.5.4 from python.org (because the Google SDK said I needed 2.5 and 2.5.6 didn't have any MSI's) Then I installed PIL from http://www.pythonware.com/products/pil/ I used version 1.1.7 for python 2.5 I used the 32-...

Does PIL create artifacting on the bottom edge of the image when you thumbnail() then crop()? If so, what is your workaround ?

When I call PIL to thumbnail() an image, and then crop(), I get artifacting on the last row of pixels -- they're either mostly black with specks of intense color, or what seems to be a not-resized area of the image ( ie, that line of pixels is at the original resolution and did not scale down with the rest ) This does not seem to happen...

How to build an image object in PIL/Python

I have a list of 3-item tuples that is the result of list(PIL.Image.getdata()). How do I do the opposite: build a PIL.Image object from this list? ...

Python PIL and StringIO

I'm trying to download images from URLs and pass them to PIL. I would like to use less resources as possible, especially RAM. What would the best way of dealing with this? I've had suggestions to use cStringIO. ...

Installing PIL on Snow Leopard

Hey, i have a problem installing PIL on Snow. I have a clean installation of macports after the upgrade to SL and installed from source the jpeg library following the OS specific installation instructions. Installing PIL with pip goes well but when i try to import the _imaging module i get the following message: Traceback (most recen...

Generate image for each font on a linux system using Python

Hello, I'm looking for a way to list all fonts installed on a linux/Debian system, and then generate images of some strings using these fonts. I'm looking for your advice as I kind of see how to do each part, but not to do both: To list all fonts on a UNIX system, xlsfonts can do the trick: import os list_of_fonts=os.popen("xslfonts"...

Django deployment: PIL and virtualenv problem

Hey guys, I'm deploying a Django site on my Vserver (Debian Lenny) and I'm having problem with PIL. I'm using virtualenv as well. When I'm in the virtualenv and type pip install -U PIL everything installs fine and I get this: *** TKINTER support not available --- JPEG support available --- ZLIB (PNG/ZIP) support available *** FREETYPE...

creating a frame to put pictures in it and saving back to database

Hello, I'm working on a mobile site and what I have to do is 1.create a picture frame 2.add to it pictures posted by users individually, then save each picture back to the database. Does anyone know how to go about this ...