8000 MNT: shorter version of Pillow API shims · matplotlib/matplotlib@bd6f04b · GitHub
[go: up one dir, main page]

Skip to content

Commit bd6f04b

Browse files
tacaswellQuLogic
andauthored
MNT: shorter version of Pillow API shims
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
1 parent f930098 commit bd6f04b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,14 +1702,8 @@ def _writeImg(self, data, id, smask=None):
17021702
num_colors = len(img_colors)
17031703
# These constants were converted to IntEnums and deprecated in
17041704
# Pillow 9.2
1705-
dither = (
1706-
Image.Dither.NONE if hasattr(Image, 'Dither')
1707-
else Image.NONE
1708-
)
1709-
pmode = (
1710-
Image.Palette.ADAPTIVE if hasattr(Image, 'Palette')
1711-
else Image.ADAPTIVE
1712-
)
1705+
dither = getattr(Image, 'Dither', Image).NONE
1706+
pmode = getattr(Image, 'Palette', Image).ADAPTIVE
17131707
img = img.convert(
17141708
mode='P', dither=dither, palette=pmode, colors=num_colors
17151709
)

0 commit comments

Comments
 (0)
0