Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/reference/ImageShow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ All default viewers convert the image to be shown to PNG format.

The following viewers may be registered on Unix-based systems, if the given command is found:

.. autoclass:: PIL.ImageShow.XDGViewer
.. autoclass:: PIL.ImageShow.DisplayViewer
.. autoclass:: PIL.ImageShow.GmDisplayViewer
.. autoclass:: PIL.ImageShow.EogViewer
Expand Down
12 changes: 12 additions & 0 deletions src/PIL/ImageShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ def show_file(self, file, **options):
return 1


class XDGViewer(UnixViewer):
"""
The freedesktop.org ``xdg-open`` command.
"""

def get_command_ex(self, file, **options):
command = executable = "xdg-open"
return command, executable


class DisplayViewer(UnixViewer):
"""
The ImageMagick ``display`` command.
Expand Down Expand Up @@ -233,6 +243,8 @@ def get_command_ex(self, file, title=None, **options):


if sys.platform not in ("win32", "darwin"): # unixoids
if shutil.which("xdg-open"):
register(XDGViewer)
if shutil.which("display"):
register(DisplayViewer)
if shutil.which("gm"):
Expand Down