Skip to content

Commit bb88d8d

Browse files
Add support to use GraphicsMagick's "gm display" as viewer
1 parent ef864d7 commit bb88d8d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/reference/ImageShow.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All default viewers convert the image to be shown to PNG format.
1818
The following viewers may be registered on Unix-based systems, if the given command is found:
1919

2020
.. autoclass:: PIL.ImageShow.DisplayViewer
21+
.. autoclass:: PIL.ImageShow.GmDisplayViewer
2122
.. autoclass:: PIL.ImageShow.EogViewer
2223
.. autoclass:: PIL.ImageShow.XVViewer
2324

src/PIL/ImageShow.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ def get_command_ex(self, file, **options):
194194
return command, executable
195195

196196

197+
class GmDisplayViewer(UnixViewer):
198+
"""The GraphicsMagick ``gm display`` command."""
199+
200+
def get_command_ex(self, file, **options):
201+
executable = "gm"
202+
command = "gm display"
203+
return command, executable
204+
205+
197206
class EogViewer(UnixViewer):
198207
"""The GNOME Image Viewer ``eog`` command."""
199208

@@ -220,6 +229,8 @@ def get_command_ex(self, file, title=None, **options):
220229
if sys.platform not in ("win32", "darwin"): # unixoids
221230
if shutil.which("display"):
222231
register(DisplayViewer)
232+
if shutil.which("gm"):
233+
register(GmDisplayViewer)
223234
if shutil.which("eog"):
224235
register(EogViewer)
225236
if shutil.which("xv"):

0 commit comments

Comments
 (0)