pil

Performing Photoshop's "Luminosity" filter programmatically

I have two JPEG's and would like to overlay one on the other with the same results as the "Luminosity" mode available in Photoshop (and Fireworks). You can read more about Luminosity mode here: http://www.adobetutorialz.com/articles/662/1/Photoshop%92s-Luminosity-Mode How can I do this? Programming language doesn't matter much, but I ...

How do I generate circuar thumbnails with PIL?

How do I generate circular image thumbnails using PIL? The space outside the circle should be transparent. Snippets would be highly appreciated, thank you in advance. ...

How to convert a Pyglet image to a PIL image?

i want to convert a Pyglet.AbstractImage object to an PIL image for further manipulation here are my codes from pyglet import image from PIL import Image pic = image.load('pic.jpg') data = pic.get_data('RGB', pic.pitch) im = Image.fromstring('RGB', (pic.width, pic.height), data) im.show() but the image shown went wrong. so how to conv...

Problem in handle PNG by the PIL

from PIL import ImageFile as PILImageFile p = PILImageFile.Parser() #Parser the data for chunk in content.chunks(): p.feed(chunk) try: image = p.close() except IOError: return None #Here the model is RGBA if image.mode != "RGB": image = image.convert("RGB") It always get stuck in here: ima...

Find images of similar color...

Hello! Based on suggestions here @ SO, I have cataloged the average color for a set of stock images. r,g,b = image.convert("RGB").resize((1,1), Image.ANTIALIAS).getpixel((0,0)) Now, I would like to present a color wheel to the user and run a search against my catalog to find images that are the closest match to the color selected. ...

how to determine the transparent color index of ICO image with PIL ?

Specifically, this is from an .ico file, so there is no "transparent" "info" attribute like you would get in a gif. The below example illustrates converting Yahoo!'s favicon to a png using the correct transparency index of "0", which I guessed. how to detect that the ico is in fact transparent and that the transparency index is 0 ? i...

writing text with diacritic ("nikud", vocalization marks) using PIL (python image library)

writing simple text on an image using PIL is easy. draw = ImageDraw.Draw(img) draw.text((10, y), text2, font=font, fill=forecolor ) however, when I try to write Hebrew punctuation marks (called "nikud" or ניקוד), the characters does not overlap as it should. I guess this question is relevant also to Arabic and other similar lang...

Is the Python Imaging Library not available on PyPI, or am I missing something?

easy_install pil results in an error: Searching for pil Reading http://pypi.python.org/simple/pil/ Reading http://www.pythonware.com/products/pil Reading http://effbot.org/zone/pil-changes-115.htm Reading http://effbot.org/downloads/#Imaging No local packages or download links found for pil error: Could not find suitable distribution fo...

Simple Image Metrics with PIL

I want to process uploaded photos with PIL and determine some "soft" image metrics like: is the image contrastful or dull? colorful or monochrome? bright or dark? is the image warm or cold (regarding light temperature)? is there a dominant hue? the metrics should be measured in a rating-style, e.g. colorful++++ for a very colorful ph...

How to reduce color palette with PIL

I'm not sure how I would go about reducing the color palette of a PIL Image. I would like to reduce an image's palette to the 5 prominent colors found in that image. My overall goal is to do some basic color sampling. ...

Generating an image thumbnail that is <10KB and did not lose proportions

Notice how for every image that google indexes it has a small thumbnail. These thumbnails are: Less than 10KB in size. The proportions of the width / height are the same as the ones in the original image. I would like to write a function (in python) that would take an image and create a thumbnail with these to properties. EDIT: So ...

Trouble using python PIL library to crop and save image

Im attempting to crop a pretty high res image and save the result to make sure its completed. However I keep getting the following error regardless of how I use the save method: SystemError: tile cannot extend outside image from PIL import Image # size is width/height img = Image.open('0_388_image1.jpeg') box = (2407, 804, 71, 796) a...

Cleaning an image to only black

I have an image. I would like to go over that image, pixel by pixel, and any pixel that is not black should be turned to white. How do I do this? (Python). Thanks! ...

Best way to programatically create image

Hi, I'm looking for a way to create a graphics file (I don't really mind the file type, as they are easily converted). The input would be the desired resolution, and a list of pixels and colors (x, y, RGB color). Is there a convenient python library for that? What are the pros\cons\pitfalls? Udi ...

How to make custom PhotoEffects in Django Photologue?

I'm creating an image gallery in Django using the Photologue application. There are a number of PhotoEffects that come with it. I'd like to extend these and make my own so that I can do more complicated effects such as adding drop shadows, glossy overlays, etc. Is is possible to create custom effects that Photologue can then use to pr...

Alternative Python imaging libraries on Google App Engine?

I am thinking about uploading images to Google App Engine, but I need to brighten parts of the image. I am not sure if the App Engine imagine API will be sufficient. I consider to try an overlay with a white image and partial opacity. However, if that does not yield the desired results, would there be another Python imaging library tha...

Getting list of pixel values from PIL

Guys, I'm looking for a bit of assistance. I'm a newbie programmer and one of the problems I'm having at the minute is trying to convert a black & white .jpg image into a list which I can then modulate into an audio signal. This is part of a lager project to create a python SSTV program. I have imported the PIL module and am trying to c...

Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)

So, Google App Engine doesn't look like it's going to include the Python Imaging Library anytime soon. There is an images api, but it's paltry, and inadequate for what I need. I'm wondering what Python only (no C-extensions) there are that can replace the Image.paste and the ImageDraw modules. I don't want to write them myself, but ...

Changing palette's of 8-bit .png images using python PIL

I'm looking for a fast way to apply a new palette to an existing 8-bit .png image. How can I do that? Is the .png re-encoded when I save the image? (Own answer: it seems so) What I have tried (edited): import Image, ImagePalette output = StringIO.StringIO() palette = (.....) #long palette of 768 items im = Image.open('test_palette.png'...

Image resizing with django?

I'm new to Django (and Python) and I have been trying to work out a few things myself, before jumping into using other people's apps. I'm having trouble understanding where things 'fit' in the Django (or Python's) way of doing things. What I'm trying to work out is how to resize an image, once it's been uploaded. I have my model setup ni...