convert to stdout, and piping it to Python/PIL
Posted: 2010-02-16T04:21:11-07:00
Hello 
I am using imagamagick to convert a file and write it to standard out
Then I would like to pipe it to a Python (2.6) program that usues the popular Python Imaging Library (PIL), like:
the program that fails is :
I would like not to use any IM python binding. This may be a topic for a Python forum but it may be more likely that IM users may have faced this problem before.
Thanks in advance for your help.
cheers,
p.

I am using imagamagick to convert a file and write it to standard out
Code: Select all
convert inimg.bmp jpeg:-
Code: Select all
convert inimg.bmp jpeg:- | python program.py
Code: Select all
import sys
import Image
imConvertOut= sys.stdin # IM convert output
pilImage = Image.open(imConvertOut)
pilImage.show() #just displays the image
Thanks in advance for your help.
cheers,

p.