pil

Is it possible to change the color of one individual pixel in Python?

I need python to change the color of one individual pixel on a picture, how do I go about that? ...

How can one perform color transforms with ICC profiles on a set of arbitrary pixel values not in an image?

I'd like to convert a set of pixel values from one profiled colorspace to another, without these values residing in an image file, such as (say) a list of RGB/RGBA/CMYK/etc data structures. I have python and PIL at my disposal (but I'm interested in solutions in related environments if that's what it takes). The latest PIL has very nic...

Change image path to image object with PIL

Hi there I am saving a image path to my model image field with custom save function. then i realised that I am just saving the path and not an actual object. my question is how to convert that path to a object using PIL. ...

Read SVG file with Python/PIL

I'm new to Python so please be patient with me. Basically my script should run like this: 1) Load an image and split it into R, G, B channels 2) Mark an area of that image with an existing path saved as a svg file and 3) perform some calculations with the R,G,B values of this area. (further send the the image either to folder A or B, ...

Where do download python PIL module from?

Where do I download the python PIL module from? I found some sites but not sure if they can be trusted. This is for my macbookpro. Is effbot the sourcE? ...

Django and PIL on Snow Leopard

I am trying to get PIL working with Django 1.2.1 and Python 2.7 on Snow Leopard I have followed instructions I found here on SO and I should be doing it right. The imports and selftest.py works fine and I both save and open images in the interactive python, but Django cannot use it. I get the error The _imaging C module is not instal...

PIL convert from cmyk to rgb looses xmp metadata

hi, i need to convert cmyk images to rgb in my python app. unfortunately the metadata gets lost in this process. import Image path = '/path/to/image.jpg' im = Image.open(path) im.convert('RGB').save(path, 'JPEG', quality=95) thank you for any advice ...

model save method. Resize image before save

Hi. I am trying to resize an image before it gets saved. I am using a custom save method on the model, but I've hit a snag. This is the code I have now: class UserImages(models.Model): height = models.CharField(blank=True, max_length=100) width = models.CharField(blank=True, max_length=100) image = models.ImageField(upload_...

How, to prevent image cache by browser?

Hi, in my Pylons app i write a script to autogenerate thumbnail, from image geting by url. To generate thumbnail i use PIL(python) W wont to prevent image cache by browser. I can't use after src ?[random_number] because the site, where i past this image must be static. I try to send headers response.headers['Cache-Control'] = 'n...

Crop non symmetric area of an image with Python/PIL

Is there a way to cut out non rectangular areas of an image with Python PIL? e.g. in this picture I want to exclude all black areas as well as towers, rooftops and poles. http://img153.imageshack.us/img153/5330/skybig.jpg I guess the ImagePath Module can do that, but furthermore, how can I read data of e.g. a svg file and convert it in...

Python Image Directories

Using PIL in python one must put the full directory for an image, so that the program runs properly. Is there any way to make that directory variable? So that it gets the programs current directory then looks for the images in that same folder? This is in Windows 7 BTW. ...

Python: PIL replace a single RGBA color

I have already taken a look at this question: SO question and seem to have implemented a very similar technique for replacing a single color including the alpha values: c = Image.open(f) c = c.convert("RGBA") w, h = c.size cnt = 0 for px in c.getdata(): c.putpixel((int(cnt % w), int(cnt / w)), (255, 0, 0, px[3])) ...

running PIL on 64bit

Is there any way of running PIL(Python Imaging Library) on a 64bit OS? it is windows 7 64bit ...

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

PIL crop and paste problem: Cropping doesn't create a cropped image

I'm trying to crop an image and then paste the cropped image into the centre of another image. Ideally I'd like the cropped image to be smaller than the image its being pasted on so that there is a border around the pasted image but I don't know if that's possible. Here's what I've tried (along with the resulting error message): >>> i...

Simple Image Manipulation with Python

What I'm trying to do: I want to give the user the ability to upload a picture that is any size. This image is then resized if it is over 1024 wide or over 768 high. It then resizes the image to be within those bounds, but keeping proportions. Then it adds a semi-transparent watermark to the lower right corner, and saves the file. Befo...

Pixel by pixel operation on image in Google App Engine using Python

I would like to go over an image and do some pixel by pixel operation. The image API provided by Google App Engine seems to be incapable to do this. And it doesn't include Python Imaging Library. So, how should I proceed with it. Thanks.. ...

How do I remove the y-axis from a Pylab-generated picture?

import pylab # matplotlib x_list = [1,1,1,1,5,4] y_list = [1,2,3,4,5,4] pylab.plot(x_list, y_list, 'bo') pylab.show() What I want to do is remove the y-axis from the diagram, only keeping the x-axis. And adding more margin to the diagram, we can see that a lot of dots are on the edge of the canvas and don't look good. ...

Converting flat sequence to 2d sequence in python

I have a piece of code that will return a flat sequence for every pixel in a image. import Image im = Image.open("test.png") print("Picture size is ", width, height) data = list(im.getdata()) for n in range(width*height): if data[n] == (0, 0, 0): print(data[n], n) This codes returns something like this ((0, 0, 0), 1250) (...

Python - PIL - Missing images

Trying to use pil for creating grid-like layout from images. But that code only draws first column. Can anyone help me? def draw(self): image=Image.new("RGB",((IMAGE_SIZE[0]+40)*5+40,(IMAGE_SIZE[1]+20)*CHILD_COUNT+20),(255,255,255)) paste_x=(-1)*IMAGE_SIZE[0] paste_y=(-1)*IMAGE_SIZE[1] i=0 for a range(5): pas...