Update matplotlib backend switching (#4987)

This commit is contained in:
Glenn Jocher 2023-09-20 00:50:30 +02:00 committed by GitHub
parent 28569ced8a
commit 7f78fad8ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -143,7 +143,7 @@ class FastSAMPrompt:
save_path = Path(output) / result_name
save_path.parent.mkdir(exist_ok=True, parents=True)
image = Image.frombytes('RGB', fig.canvas.get_width_height(), fig.canvas.buffer_rgba())
image = Image.frombytes('RGB', fig.canvas.get_width_height(), fig.canvas.tostring_rgb())
image.save(save_path)
plt.close()
pbar.set_description(f'Saving {result_name} to {save_path}')