8000 Merge pull request #5171 from cgohlke/patch-11 · matplotlib/matplotlib@f39caf1 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f39caf1

Browse files
committed
Merge pull request #5171 from cgohlke/patch-11
Fix exception with Pillow 3
1 parent 0bbff96 commit f39caf1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/pylab_examples/agg_buffer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
convert it to an array and pass it to Pillow for rendering.
55
"""
66

7+
import numpy as np
8+
79
import matplotlib.pyplot as plt
810
from matplotlib.backends.backend_agg import FigureCanvasAgg
911

@@ -28,7 +30,10 @@
2830
X = np.fromstring(s, np.uint8)
2931
X.shape = h, w, 3
3032

31-
im = Image.fromstring("RGB", (w, h), s)
33+
try:
34+
im = Image.fromstring("RGB", (w, h), s)
35+
except Exception:
36+
im = Image.frombytes("RGB", (w, h), s)
3237

3338
# Uncomment this line to display the image using ImageMagick's
3439
# `display` tool.

0 commit comments

Comments
 (0)
0