Skip to content

Commit

Permalink
Replace deprecated tostring_rgb to buffer_rgba
Browse files Browse the repository at this point in the history
Replace deprecated tostring_rgb to buffer_rgba
  • Loading branch information
amanteur authored Jan 26, 2025
1 parent ffeaaa1 commit 91de35e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions oml/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def visualise_text(text: str, color: TColor = BLACK, draw_bbox: bool = True) ->

fig.canvas.draw()
width, height = fig.canvas.get_width_height()
image = np.frombuffer(fig.canvas.tostring_rgb(), dtype=np.uint8)
image = image.reshape(height, width, 3)
image = np.frombuffer(fig.canvas.buffer_rgba(), dtype=np.uint8)
image = image.reshape(height, width, 4)[..., :3]
plt.close(fig)

image = np.resize(image, (256, 256, 3))
Expand Down

0 comments on commit 91de35e

Please sign in to comment.