python-imaging-library

Installing PIL (Python Imaging Library) in Win7 64 bits, Python 2.6.4

I'm trying to install said library for use with Python. I tried downloading the executable installer for Windows, which runs, but says it doesn't find a Python installation. Then tried registering (http://effbot.org/zone/python-register.htm) Python, but the script says it can't register (although the keys appear in my register). Then I ...

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 ...

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. ...

django / python get image from url and display on site

Hi, Given a url to an image is there a way in Django/Python to pull this image in and then display it on my site (resized if possible) Thanks ...

How to invert colors of image with PIL (Python-Imaging)?

I need to convert series of images drawn as white on black background letters to images where white and black are inverted (as negative). How can I achieve this using PIL? ...

Error Converting PIL B&W images to Numpy Arrays

I am getting weird errors when I try to convert a black and white PIL image to a numpy array. An example of the code I am working with is below. if image.mode != '1': image = image.convert('1') #convert to B&W data = np.array(image) #Have also tried np.asarray(image) n_lines = data.shape[0] #number of raster passes ...

sorl-thumbnail unit tests fail by 1 pixel (!)

Hi I'm using sorl-thumbnail in a Django 1.2 (currently 1.2 RC) project and getting a surprising failure of four of sorl's built-in unit tests. Essentially, the resized images are all 1px shorter than the unit tests expect them to be. See below for details I'm developing on OSX 10.5.8 (not Snow Leopard) with Python 2.5.1 (r251:54863, F...

centos libjpeg error _imaging

hey guys. I am trying to get my libjpeg working with python with little or no luck. I have followed this tutorial to get it up and running http://blaolao.com/setting-up-django-mysql-mysql-python-pil-etc on my 10.6, worked like a charm now that I am looking at getting this onto my server I am getting stuck I believe it already had lib...

The _imaging C module is not installed

Hi there. I have a bit of a problem and don't know where to look for answers, hopefully someone has come across it. I have PIL(Python imaging library installed) when I run python import PILimport Image import _imaging I don't get errors. however running my app raises _imaging C module not installed ...

Can this image processing code be optimised to use less memory?

Hello stackoverflow, I have a python function that takes a string s-expression like "(add (sub 10 5) 5)", where "add" and "sub" are actually image processing functions, and evaluates and creates the image represented in the string. The image processing functions take constants, variables, or other images (represented as lists of vectors...

How do the PIL ImageFilter enhancement filters work?

Where can I find information on what algorithms the PIL ImageFilter functions use? Like how does edge_enhance work? I'm looking to implement a difference of Gaussians filter but if PIL has a filter that works similarly I'll use that. ...

Should I use ImageMath or ImageChops?

The PIL handbook says ImageMath (containing a function to evaluate expressions) is new in version 1.1.6. Is it now obsolete? It seems like ImageChops has similar functions to perform arithmetic operators on images. ...

how to displace an image in python?

I have an image size 400*200. I have a frame size 400* 300. I want to put the image in the center of frame. That is my image cordinate (0,0) starts with the frame cordinates (0,50). ...

What's the simplest way in Python to resize an image to a given bounded area?

I'd like to create a function, like: def generateThumbnail(self, width, height): """ Generates thumbnails for an image """ im = Image.open(self._file) im.thumbnail((width, height), Image.ANTIALIAS) im.save(self._path + str(width) + 'x' + str(height) + '-' + self._filename, "JPEG") Where a fi...

Django ImageField: files dont get uploaded...

Hello, I implemented some ImageFields in my model and installed PIL (not the cleanest install). Things seem to work as I get an upload button in the admin and when I call the .url property in the view I get the string with the filename + its upload property. The problem is that the file is not there, apparently it doesnt get uploaded onc...

Image analyze? - Python

i try agin, i need to analyze a picture pixel by pixel and return it in XML or Array output, eg. xml <picture> <pixelline id="1"> <pixel id="1" color="#000000" /> <pixel id="2" color="#000000" /> <pixel id="3" color="#000000 /> <pixel id="4" color="#000000" /> </pixelline> <pixelline id="2"> <pixel id="1" color="#000000" /> <pixel id="2...