When toying with images in the python shell, I use image.show(), where image is an instance of Image. Long ago nothing happened, but after defining a symlink to mirage named "xv", I was happy.
The last few days, show() will bring up both ImageMagick's display and also Mirage. It's not clear where show() gets information on what to run. Documentation wasn't helpful. How to make it behave and bring up only what it thinks is xv?
Well, for one thing, im.show is only intended for debugging purpose, it isn't guaranteed to work.
Nevertheless, you can always look at the source (open "pydoc PIL", the FILE section points out where a module is located):
In Windows, PIL will use "start /wait filename"
In Macs, it uses "open -a /Applications/Preview.app"
and on Linux, either 'display' if found or otherwise 'xdg-open'.
ImageShow
has a list of supported and available viewers inImageShow._viewers
. On my box, two viewers are found:Unfortunately
ImageShow.show()
uses all available viewers. Thus two windows are displayed.A solution is to reduce the viewer registry to only the first available viewer:
A sort of a workaround I found.
I used:
Opened the png from the file manager using the default preview program. Then every time I called
save
again, the previewer automatically refreshed, and I got the new image :)it is able to specify the viewer as
command
argument to theshow
method, e.g.I encountered the same problem, it is a problem in PIL. You can change the PIL code in the following way:
In the file ImageShow.py replace
with
A little out-off-dated but... I solved this problem changing the code of file
/usr/lib/python2.7/dist-packages/PIL/ImageShow.py
. Is missing areturn
on methodshow
ofViewer
class (near line 66):return self.show_image(image, **options)
.