Python: The _imagingft C module is not installed

On Ubuntu, you need to have libfreetype-dev installed before compiling PIL. i.e. $ sudo apt-get install libfreetype6-dev $ sudo -s \# pip uninstall pil \# pip install –no-cache-dir pil PS! Running pip install as sudo will usually install packages to /usr/local/lib on most Ubuntu versions. You may consider to install Pil in a virtual environment … Read more

Convert opencv image format to PIL image format?

Yes OpenCV is more robust and flexible and can perform most of the image processing routines which are available out there, So probably this filter can be done with OpenCV> However, there may not be a straightforward API for that. Anyways, as far as the conversion of image format from OpenCV to PIL is concerned … Read more

how to save a pylab figure into in-memory file which can be read into PIL image?

Remember to call buf.seek(0) so Image.open(buf) starts reading from the beginning of the buf: import io from PIL import Image import matplotlib.pyplot as plt plt.figure() plt.plot([1, 2]) plt.title(“test”) buf = io.BytesIO() plt.savefig(buf, format=”png”) buf.seek(0) im = Image.open(buf) im.show() buf.close()