PILLOW image module fails to show images on command line in Raspbian

434 Views Asked by At

On a raspberry Pi running stretch lite with Python 2.7, this does not work

from PIL import Image
pic = Image.open('image1.jpg')
pic.show('title', command = 'fbi')

It gives

display-im6.q16: unsble to open X server `' @ error/display.c/DisplayImageCommand/432

but

fbi image1.jpg works fine

I also tried installing fim, tested fim and it works fine from the command line but also fails when pillow is directed to use it. I'd rather not add a ton of X server code or openCV modules just to show a pic. The only solution I have come up with is to open another terminal (alt-F2) and issue the fbi command there while the python process generates the images. Or I suppose I can try to spawn an fbi process from within the python script but then fbi blocks execution while it pauses for user input.

0

There are 0 best solutions below