Skip to content

Commit

Permalink
Add support to use GraphicsMagick's "gm display" as viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
latosha-maltba committed Mar 21, 2021
1 parent ef864d7 commit bb88d8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/reference/ImageShow.rst
Expand Up @@ -18,6 +18,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.DisplayViewer
.. autoclass:: PIL.ImageShow.GmDisplayViewer
.. autoclass:: PIL.ImageShow.EogViewer
.. autoclass:: PIL.ImageShow.XVViewer

Expand Down
11 changes: 11 additions & 0 deletions src/PIL/ImageShow.py
Expand Up @@ -194,6 +194,15 @@ def get_command_ex(self, file, **options):
return command, executable


class GmDisplayViewer(UnixViewer):
"""The GraphicsMagick ``gm display`` command."""

def get_command_ex(self, file, **options):
executable = "gm"
command = "gm display"
return command, executable


class EogViewer(UnixViewer):
"""The GNOME Image Viewer ``eog`` command."""

Expand All @@ -220,6 +229,8 @@ def get_command_ex(self, file, title=None, **options):
if sys.platform not in ("win32", "darwin"): # unixoids
if shutil.which("display"):
register(DisplayViewer)
if shutil.which("gm"):
register(GmDisplayViewer)
if shutil.which("eog"):
register(EogViewer)
if shutil.which("xv"):
Expand Down

0 comments on commit bb88d8d

Please sign in to comment.