diff --git a/docs/reference/ImageShow.rst b/docs/reference/ImageShow.rst index f1fbd90ce3a..e4d9805ab4c 100644 --- a/docs/reference/ImageShow.rst +++ b/docs/reference/ImageShow.rst @@ -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 diff --git a/src/PIL/ImageShow.py b/src/PIL/ImageShow.py index 3368865a46d..6cc420d1b01 100644 --- a/src/PIL/ImageShow.py +++ b/src/PIL/ImageShow.py @@ -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.""" @@ -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"):