Skip to content

Commit a6cc523

Browse files
authored
Merge pull request matplotlib#30229 from meeseeksmachine/auto-backport-of-pr-30221-on-v3.10.x
Backport PR matplotlib#30221 on branch v3.10.x (BUG: fix future incompatibility with Pillow 13)
2 parents 6b739e1 + f24ff7e commit a6cc523

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def _recolor_icon(image, color):
775775
image_data = np.asarray(image).copy()
776776
black_mask = (image_data[..., :3] == 0).all(axis=-1)
777777
image_data[black_mask, :3] = color
778-
return Image.fromarray(image_data, mode="RGBA")
778+
return Image.fromarray(image_data)
779779

780780
# Use the high-resolution (48x48 px) icon if it exists and is needed
781781
with Image.open(path_large if (size > 24 and path_large.exists())

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ def _writeImg(self, data, id, smask=None):
17581758
data[:, :, 2])
17591759
indices = np.argsort(palette24).astype(np.uint8)
17601760
rgb8 = indices[np.searchsorted(palette24, rgb24, sorter=indices)]
1761-
img = Image.fromarray(rgb8, mode='P')
1761+
img = Image.fromarray(rgb8).convert("P")
17621762
img.putpalette(palette)
17631763
png_data, bit_depth, palette = self._writePng(img)
17641764
if bit_depth is None or palette is None:

0 commit comments

Comments
 (0)