Skip to content

Navigation Menu

Sign in
Appearance settings

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 c8b0da5

Browse filesBrowse files
committed
Avoid a buffer copy in PillowWriter.
1 parent d062859 commit c8b0da5
Copy full SHA for c8b0da5

File tree

Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-5
lines changed

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,12 +563,10 @@ def grab_frame(self, **savefig_kwargs):
563563
buf = BytesIO()
564564
self._fig.savefig(buf, **dict(savefig_kwargs, format="rgba"))
565565
renderer = self._fig.canvas.get_renderer()
566-
# Using frombuffer / getbuffer may be slightly more efficient, but
567-
# Py3-only.
568-
self._frames.append(Image.frombytes(
566+
self._frames.append(Image.frombuffer(
569567
"RGBA",
570-
(int(renderer.width), int(renderer.height)),
571-
buf.getvalue()))
568+
(int(renderer.width), int(renderer.height)), buf.getbuffer(),
569+
"raw", "RGBA", 0, 1))
572570

573571
def finish(self):
574572
self._frames[0].save(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.