File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -196,14 +196,15 @@ def get_diff_image(self):
196
196
diff = buff != self ._last_buff
197
197
output = np .where (diff , buff , 0 )
198
198
199
- buf = BytesIO ()
200
- data = output .view (dtype = np .uint8 ).reshape ((* output .shape , 4 ))
201
- Image .fromarray (data ).save (buf , format = "png" )
202
- # store the current buffer so we can compute the next diff
199
+ # Store the current buffer so we can compute the next diff.
203
200
np .copyto (self ._last_buff , buff )
204
201
self ._force_full = False
205
202
self ._png_is_old = False
206
- return buf .getvalue ()
203
+
204
+ data = output .view (dtype = np .uint8 ).reshape ((* output .shape , 4 ))
205
+ with BytesIO () as png :
206
+ Image .fromarray (data ).save (png , format = "png" )
207
+ return png .getvalue ()
207
208
208
209
def get_renderer (self , cleared = None ):
209
210
# Mirrors super.get_renderer, but caches the old one so that we can do
You can’t perform that action at this time.
0 commit comments