Fix Python – Can’t install PIL after Mac OS X 10.9

I’ve just updated my Mac OS to 10.9 and I discovered that some (all?) of my Python modules are not here anymore, especially the Image one.
So I try to execute sudo pip install pil, but I get this error:
/Applications/ fatal error: ‘X11/Xlib…..

Fix Python – Convert RGBA PNG to RGB with PIL

I’m using PIL to convert a transparent PNG image uploaded with Django to a JPG file. The output looks broken.
Source file

Code‘/tmp/output.jpg’, ‘JPEG’)


Both ways, the resulting image looks like this:

Is there a way to fix this? I’d….

Fix Python – How can I save an image with PIL?

I have just done some image processing using the Python image library (PIL) using a post I found earlier to perform fourier transforms of images and I can’t get the save function to work. The whole code works fine but it just wont save the resulting image:
from PIL import Image
import numpy as np

i =“C:/Users/User/Desktop/mesh.bmp”)

Fix Python – Convert image from PIL to openCV format

I’m trying to convert image from PIL to OpenCV format. I’m using OpenCV 2.4.3.
here is what I’ve attempted till now.
>>> from PIL import Image
>>> import cv2 as cv
>>> pimg =‘D:\\traffic.jpg’) #PIL Image
>>> cimg =,cv.IPL_DEPTH_8U,3) #CV Image

Fix Python – Combine several images horizontally with Python

I am trying to horizontally combine some JPEG images in Python.
I have 3 images – each is 148 x 95 – see attached. I just made 3 copies of the same image – that is why they are the same.

My attempt
I am trying to horizontally join them using the following code:
import sys
from PIL import Image

list_im = [‘Test1.jpg’,’Test2.jpg’,’….

Fix Python – How to convert a NumPy array to PIL image applying matplotlib colormap

I have a simple problem, but I cannot find a good solution to it.
I want to take a NumPy 2D array which represents a grayscale image, and convert it to an RGB PIL image while applying some of the matplotlib colormaps.
I can get a reasonable PNG output by using the pyplot.figure.figimage command:
dpi = 100.0
w, h = myarray.shape[1]/dpi, myarray.sha….