Skip to content

Commit

Permalink
Do not down-convert if image is LA when showing with PNG format
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed May 25, 2019
1 parent e24b494 commit 3645867
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/PIL/ImageShow.py
Expand Up @@ -71,7 +71,9 @@ def show(self, image, **options):
# FIXME: auto-contrast if max() > 255?
else:
base = Image.getmodebase(image.mode)
if base != image.mode and image.mode != "1" and image.mode != "RGBA":
if not (base == image.mode or
image.mode in ("1", "RGBA") or
(self.format == "PNG" and image.mode == "LA")):
image = image.convert(base)

return self.show_image(image, **options)
Expand Down

0 comments on commit 3645867

Please sign in to comment.