We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
later commits to PR 2509 broken the compress_level=1 setting
This is a follow-up to #2509 .

Using the same test file from #2508 with current head ( 1.7.6-5795-g82c51e4 / 82c51e4 is )
https://cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png

```
from PIL import Image
Image.open("cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png").show()
Image.open("cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png").save("m.png", compress_level=1)
```

The file size are as follows:
```
-rw-------. 1 Hin-Tak Hin-Tak   28907 May 14 00:59 tmpEYXgFV.PNG
-rw-------. 1 Hin-Tak Hin-Tak   28907 May 14 00:42 tmpud2qIG.PNG
-rw-rw-r--. 1 Hin-Tak Hin-Tak   36127 May 14 00:44 m.png
-rw-rw-r--. 1 Hin-Tak Hin-Tak 36127 May 14 01:00 m.png
```

The original is 29069 bytes. I did test in #2509 that I got the 36127 larger file size for minimum compression, instead of what 1.7.6-5795-g82c51e4 / 82c51e4 is now giving, the 28907 smaller file size.
So some of @wiredfool 's "improvements" broke the minumum compression setting, which I last tested worked in my #2509 series.

Anyway, you should aim at

```
from PIL import Image
Image.open("cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png").show()
```

giving a /tmp/tmpPWRSTU.PNG of around 36k, not 28k.

Considered my experience in #2509, I'd prefer to switch off notification for this.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `PIL/ImageShow.py`
Content:
```
1 #
2 # The Python Imaging Library.
3 # $Id$
4 #
5 # im.show() drivers
6 #
7 # History:
8 # 2008-04-06 fl   Created
9 #
10 # Copyright (c) Secret Labs AB 2008.
11 #
12 # See the README file for information on usage and redistribution.
13 #
14 
15 from __future__ import print_function
16 
17 from PIL import Image
18 import os
19 import sys
20 
21 if sys.version_info >= (3, 3):
22     from shlex import quote
23 else:
24     from pipes import quote
25 
26 _viewers = []
27 
28 
29 def register(viewer, order=1):
30     try:
31         if issubclass(viewer, Viewer):
32             viewer = viewer()
33     except TypeError:
34         pass  # raised if viewer wasn't a class
35     if order > 0:
36         _viewers.append(viewer)
37     elif order < 0:
38         _viewers.insert(0, viewer)
39 
40 
41 def show(image, title=None, **options):
42     r"""
43     Display a given image.
44 
45     :param image: An image object.
46     :param title: Optional title.  Not all viewers can display the title.
47     :param \**options: Additional viewer options.
48     :returns: True if a suitable viewer was found, false otherwise.
49     """
50     for viewer in _viewers:
51         if viewer.show(image, title=title, **options):
52             return 1
53     return 0
54 
55 
56 class Viewer(object):
57     """Base class for viewers."""
58 
59     # main api
60 
61     def show(self, image, **options):
62 
63         # save temporary image to disk
64         if image.mode[:4] == "I;16":
65             # @PIL88 @PIL101
66             # "I;16" isn't an 'official' mode, but we still want to
67             # provide a simple way to show 16-bit images.
68             base = "L"
69             # FIXME: auto-contrast if max() > 255?
70         else:
71             base = Image.getmodebase(image.mode)
72         if base != image.mode and image.mode != "1" and image.mode != "RGBA":
73             image = image.convert(base)
74 
75         return self.show_image(image, **options)
76 
77     # hook methods
78 
79     format = None
80     options = {}
81 
82     def get_format(self, image):
83         """Return format name, or None to save as PGM/PPM"""
84         return self.format
85 
86     def get_command(self, file, **options):
87         raise NotImplementedError
88 
89     def save_image(self, image):
90         """Save to temporary file, and return filename"""
91         return image._dump(format=self.get_format(image), **self.options)
92 
93     def show_image(self, image, **options):
94         """Display given image"""
95         return self.show_file(self.save_image(image), **options)
96 
97     def show_file(self, file, **options):
98         """Display given file"""
99         os.system(self.get_command(file, **options))
100         return 1
101 
102 # --------------------------------------------------------------------
103 
104 if sys.platform == "win32":
105 
106     class WindowsViewer(Viewer):
107         format = "BMP"
108 
109         def get_command(self, file, **options):
110             return ('start "Pillow" /WAIT "%s" '
111                     '&& ping -n 2 127.0.0.1 >NUL '
112                     '&& del /f "%s"' % (file, file))
113 
114     register(WindowsViewer)
115 
116 elif sys.platform == "darwin":
117 
118     class MacViewer(Viewer):
119         format = "PNG"
120         options = {'compress-level': 1}
121 
122         def get_command(self, file, **options):
123             # on darwin open returns immediately resulting in the temp
124             # file removal while app is opening
125             command = "open -a /Applications/Preview.app"
126             command = "(%s %s; sleep 20; rm -f %s)&" % (command, quote(file),
127                                                         quote(file))
128             return command
129 
130     register(MacViewer)
131 
132 else:
133 
134     # unixoids
135 
136     def which(executable):
137         path = os.environ.get("PATH")
138         if not path:
139             return None
140         for dirname in path.split(os.pathsep):
141             filename = os.path.join(dirname, executable)
142             if os.path.isfile(filename) and os.access(filename, os.X_OK):
143                 return filename
144         return None
145 
146     class UnixViewer(Viewer):
147         format = "PNG"
148         options = {'compress-level': 1}
149 
150         def show_file(self, file, **options):
151             command, executable = self.get_command_ex(file, **options)
152             command = "(%s %s; rm -f %s)&" % (command, quote(file),
153                                               quote(file))
154             os.system(command)
155             return 1
156 
157     # implementations
158 
159     class DisplayViewer(UnixViewer):
160         def get_command_ex(self, file, **options):
161             command = executable = "display"
162             return command, executable
163 
164     if which("display"):
165         register(DisplayViewer)
166 
167     class XVViewer(UnixViewer):
168         def get_command_ex(self, file, title=None, **options):
169             # note: xv is pretty outdated.  most modern systems have
170             # imagemagick's display command instead.
171             command = executable = "xv"
172             if title:
173                 command += " -name %s" % quote(title)
174             return command, executable
175 
176     if which("xv"):
177         register(XVViewer)
178 
179 if __name__ == "__main__":
180     # usage: python ImageShow.py imagefile [title]
181     print(show(Image.open(sys.argv[1]), *sys.argv[2:]))
182
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py
--- a/PIL/ImageShow.py
+++ b/PIL/ImageShow.py
@@ -117,7 +117,7 @@
 
     class MacViewer(Viewer):
         format = "PNG"
-        options = {'compress-level': 1}
+        options = {'compress_level': 1}
 
         def get_command(self, file, **options):
             # on darwin open returns immediately resulting in the temp
@@ -145,7 +145,7 @@
 
     class UnixViewer(Viewer):
         format = "PNG"
-        options = {'compress-level': 1}
+        options = {'compress_level': 1}
 
         def show_file(self, file, **options):
             command, executable = self.get_command_ex(file, **options)

{"golden_diff": "diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py\n--- a/PIL/ImageShow.py\n+++ b/PIL/ImageShow.py\n@@ -117,7 +117,7 @@\n \n     class MacViewer(Viewer):\n         format = \"PNG\"\n-        options = {'compress-level': 1}\n+        options = {'compress_level': 1}\n \n         def get_command(self, file, **options):\n             # on darwin open returns immediately resulting in the temp\n@@ -145,7 +145,7 @@\n \n     class UnixViewer(Viewer):\n         format = \"PNG\"\n-        options = {'compress-level': 1}\n+        options = {'compress_level': 1}\n \n         def show_file(self, file, **options):\n             command, executable = self.get_command_ex(file, **options)\n", "issue": "later commits to PR 2509 broken the compress_level=1 setting\nThis is a follow-up to #2509 .\r\n\r\nUsing the same test file from #2508 with current head ( 1.7.6-5795-g82c51e4 / 82c51e4 is )\r\nhttps://cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png\r\n\r\n```\r\nfrom PIL import Image\r\nImage.open(\"cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png\").show()\r\nImage.open(\"cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png\").save(\"m.png\", compress_level=1)\r\n```\r\n\r\nThe file size are as follows:\r\n```\r\n-rw-------. 1 Hin-Tak Hin-Tak   28907 May 14 00:59 tmpEYXgFV.PNG\r\n-rw-------. 1 Hin-Tak Hin-Tak   28907 May 14 00:42 tmpud2qIG.PNG\r\n-rw-rw-r--. 1 Hin-Tak Hin-Tak   36127 May 14 00:44 m.png\r\n-rw-rw-r--. 1 Hin-Tak Hin-Tak 36127 May 14 01:00 m.png\r\n```\r\n\r\nThe original is 29069 bytes. I did test in #2509 that I got the 36127 larger file size for minimum compression, instead of what 1.7.6-5795-g82c51e4 / 82c51e4 is now giving, the 28907 smaller file size.\r\nSo some of @wiredfool 's \"improvements\" broke the minumum compression setting, which I last tested worked in my #2509 series.\r\n\r\nAnyway, you should aim at\r\n\r\n```\r\nfrom PIL import Image\r\nImage.open(\"cloud.githubusercontent.com/assets/327203/25754502/be994452-31bf-11e7-85da-9cc7fb2811bd.png\").show()\r\n```\r\n\r\ngiving a /tmp/tmpPWRSTU.PNG of around 36k, not 28k.\r\n\r\nConsidered my experience in #2509, I'd prefer to switch off notification for this.\r\n\n", "before_files": [{"content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# im.show() drivers\n#\n# History:\n# 2008-04-06 fl   Created\n#\n# Copyright (c) Secret Labs AB 2008.\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom __future__ import print_function\n\nfrom PIL import Image\nimport os\nimport sys\n\nif sys.version_info >= (3, 3):\n    from shlex import quote\nelse:\n    from pipes import quote\n\n_viewers = []\n\n\ndef register(viewer, order=1):\n    try:\n        if issubclass(viewer, Viewer):\n            viewer = viewer()\n    except TypeError:\n        pass  # raised if viewer wasn't a class\n    if order > 0:\n        _viewers.append(viewer)\n    elif order < 0:\n        _viewers.insert(0, viewer)\n\n\ndef show(image, title=None, **options):\n    r\"\"\"\n    Display a given image.\n\n    :param image: An image object.\n    :param title: Optional title.  Not all viewers can display the title.\n    :param \\**options: Additional viewer options.\n    :returns: True if a suitable viewer was found, false otherwise.\n    \"\"\"\n    for viewer in _viewers:\n        if viewer.show(image, title=title, **options):\n            return 1\n    return 0\n\n\nclass Viewer(object):\n    \"\"\"Base class for viewers.\"\"\"\n\n    # main api\n\n    def show(self, image, **options):\n\n        # save temporary image to disk\n        if image.mode[:4] == \"I;16\":\n            # @PIL88 @PIL101\n            # \"I;16\" isn't an 'official' mode, but we still want to\n            # provide a simple way to show 16-bit images.\n            base = \"L\"\n            # FIXME: auto-contrast if max() > 255?\n        else:\n            base = Image.getmodebase(image.mode)\n        if base != image.mode and image.mode != \"1\" and image.mode != \"RGBA\":\n            image = image.convert(base)\n\n        return self.show_image(image, **options)\n\n    # hook methods\n\n    format = None\n    options = {}\n\n    def get_format(self, image):\n        \"\"\"Return format name, or None to save as PGM/PPM\"\"\"\n        return self.format\n\n    def get_command(self, file, **options):\n        raise NotImplementedError\n\n    def save_image(self, image):\n        \"\"\"Save to temporary file, and return filename\"\"\"\n        return image._dump(format=self.get_format(image), **self.options)\n\n    def show_image(self, image, **options):\n        \"\"\"Display given image\"\"\"\n        return self.show_file(self.save_image(image), **options)\n\n    def show_file(self, file, **options):\n        \"\"\"Display given file\"\"\"\n        os.system(self.get_command(file, **options))\n        return 1\n\n# --------------------------------------------------------------------\n\nif sys.platform == \"win32\":\n\n    class WindowsViewer(Viewer):\n        format = \"BMP\"\n\n        def get_command(self, file, **options):\n            return ('start \"Pillow\" /WAIT \"%s\" '\n                    '&& ping -n 2 127.0.0.1 >NUL '\n                    '&& del /f \"%s\"' % (file, file))\n\n    register(WindowsViewer)\n\nelif sys.platform == \"darwin\":\n\n    class MacViewer(Viewer):\n        format = \"PNG\"\n        options = {'compress-level': 1}\n\n        def get_command(self, file, **options):\n            # on darwin open returns immediately resulting in the temp\n            # file removal while app is opening\n            command = \"open -a /Applications/Preview.app\"\n            command = \"(%s %s; sleep 20; rm -f %s)&\" % (command, quote(file),\n                                                        quote(file))\n            return command\n\n    register(MacViewer)\n\nelse:\n\n    # unixoids\n\n    def which(executable):\n        path = os.environ.get(\"PATH\")\n        if not path:\n            return None\n        for dirname in path.split(os.pathsep):\n            filename = os.path.join(dirname, executable)\n            if os.path.isfile(filename) and os.access(filename, os.X_OK):\n                return filename\n        return None\n\n    class UnixViewer(Viewer):\n        format = \"PNG\"\n        options = {'compress-level': 1}\n\n        def show_file(self, file, **options):\n            command, executable = self.get_command_ex(file, **options)\n            command = \"(%s %s; rm -f %s)&\" % (command, quote(file),\n                                              quote(file))\n            os.system(command)\n            return 1\n\n    # implementations\n\n    class DisplayViewer(UnixViewer):\n        def get_command_ex(self, file, **options):\n            command = executable = \"display\"\n            return command, executable\n\n    if which(\"display\"):\n        register(DisplayViewer)\n\n    class XVViewer(UnixViewer):\n        def get_command_ex(self, file, title=None, **options):\n            # note: xv is pretty outdated.  most modern systems have\n            # imagemagick's display command instead.\n            command = executable = \"xv\"\n            if title:\n                command += \" -name %s\" % quote(title)\n            return command, executable\n\n    if which(\"xv\"):\n        register(XVViewer)\n\nif __name__ == \"__main__\":\n    # usage: python ImageShow.py imagefile [title]\n    print(show(Image.open(sys.argv[1]), *sys.argv[2:]))\n", "path": "PIL/ImageShow.py"}], "after_files": [{"content": "#\n# The Python Imaging Library.\n# $Id$\n#\n# im.show() drivers\n#\n# History:\n# 2008-04-06 fl   Created\n#\n# Copyright (c) Secret Labs AB 2008.\n#\n# See the README file for information on usage and redistribution.\n#\n\nfrom __future__ import print_function\n\nfrom PIL import Image\nimport os\nimport sys\n\nif sys.version_info >= (3, 3):\n    from shlex import quote\nelse:\n    from pipes import quote\n\n_viewers = []\n\n\ndef register(viewer, order=1):\n    try:\n        if issubclass(viewer, Viewer):\n            viewer = viewer()\n    except TypeError:\n        pass  # raised if viewer wasn't a class\n    if order > 0:\n        _viewers.append(viewer)\n    elif order < 0:\n        _viewers.insert(0, viewer)\n\n\ndef show(image, title=None, **options):\n    r\"\"\"\n    Display a given image.\n\n    :param image: An image object.\n    :param title: Optional title.  Not all viewers can display the title.\n    :param \\**options: Additional viewer options.\n    :returns: True if a suitable viewer was found, false otherwise.\n    \"\"\"\n    for viewer in _viewers:\n        if viewer.show(image, title=title, **options):\n            return 1\n    return 0\n\n\nclass Viewer(object):\n    \"\"\"Base class for viewers.\"\"\"\n\n    # main api\n\n    def show(self, image, **options):\n\n        # save temporary image to disk\n        if image.mode[:4] == \"I;16\":\n            # @PIL88 @PIL101\n            # \"I;16\" isn't an 'official' mode, but we still want to\n            # provide a simple way to show 16-bit images.\n            base = \"L\"\n            # FIXME: auto-contrast if max() > 255?\n        else:\n            base = Image.getmodebase(image.mode)\n        if base != image.mode and image.mode != \"1\" and image.mode != \"RGBA\":\n            image = image.convert(base)\n\n        return self.show_image(image, **options)\n\n    # hook methods\n\n    format = None\n    options = {}\n\n    def get_format(self, image):\n        \"\"\"Return format name, or None to save as PGM/PPM\"\"\"\n        return self.format\n\n    def get_command(self, file, **options):\n        raise NotImplementedError\n\n    def save_image(self, image):\n        \"\"\"Save to temporary file, and return filename\"\"\"\n        return image._dump(format=self.get_format(image), **self.options)\n\n    def show_image(self, image, **options):\n        \"\"\"Display given image\"\"\"\n        return self.show_file(self.save_image(image), **options)\n\n    def show_file(self, file, **options):\n        \"\"\"Display given file\"\"\"\n        os.system(self.get_command(file, **options))\n        return 1\n\n# --------------------------------------------------------------------\n\nif sys.platform == \"win32\":\n\n    class WindowsViewer(Viewer):\n        format = \"BMP\"\n\n        def get_command(self, file, **options):\n            return ('start \"Pillow\" /WAIT \"%s\" '\n                    '&& ping -n 2 127.0.0.1 >NUL '\n                    '&& del /f \"%s\"' % (file, file))\n\n    register(WindowsViewer)\n\nelif sys.platform == \"darwin\":\n\n    class MacViewer(Viewer):\n        format = \"PNG\"\n        options = {'compress_level': 1}\n\n        def get_command(self, file, **options):\n            # on darwin open returns immediately resulting in the temp\n            # file removal while app is opening\n            command = \"open -a /Applications/Preview.app\"\n            command = \"(%s %s; sleep 20; rm -f %s)&\" % (command, quote(file),\n                                                        quote(file))\n            return command\n\n    register(MacViewer)\n\nelse:\n\n    # unixoids\n\n    def which(executable):\n        path = os.environ.get(\"PATH\")\n        if not path:\n            return None\n        for dirname in path.split(os.pathsep):\n            filename = os.path.join(dirname, executable)\n            if os.path.isfile(filename) and os.access(filename, os.X_OK):\n                return filename\n        return None\n\n    class UnixViewer(Viewer):\n        format = \"PNG\"\n        options = {'compress_level': 1}\n\n        def show_file(self, file, **options):\n            command, executable = self.get_command_ex(file, **options)\n            command = \"(%s %s; rm -f %s)&\" % (command, quote(file),\n                                              quote(file))\n            os.system(command)\n            return 1\n\n    # implementations\n\n    class DisplayViewer(UnixViewer):\n        def get_command_ex(self, file, **options):\n            command = executable = \"display\"\n            return command, executable\n\n    if which(\"display\"):\n        register(DisplayViewer)\n\n    class XVViewer(UnixViewer):\n        def get_command_ex(self, file, title=None, **options):\n            # note: xv is pretty outdated.  most modern systems have\n            # imagemagick's display command instead.\n            command = executable = \"xv\"\n            if title:\n                command += \" -name %s\" % quote(title)\n            return command, executable\n\n    if which(\"xv\"):\n        register(XVViewer)\n\nif __name__ == \"__main__\":\n    # usage: python ImageShow.py imagefile [title]\n    print(show(Image.open(sys.argv[1]), *sys.argv[2:]))\n", "path": "PIL/ImageShow.py"}]}