From 94648cca00619cd6316d04b977295d61ab879517 Mon Sep 17 00:00:00 2001 From: Shehab Date: Wed, 11 Feb 2026 14:50:45 -0500 Subject: [PATCH] Changed contig.tostring() -> contig.tobytes() because tostring() is deprecated in numpy>=1.19 and removed entirely in newer versions of numpy. --- ros2_numpy/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ros2_numpy/image.py b/ros2_numpy/image.py index bee1ded..d34ece7 100644 --- a/ros2_numpy/image.py +++ b/ros2_numpy/image.py @@ -110,7 +110,7 @@ def numpy_to_image(arr, encoding): # make the array contiguous in memory, as mostly required by the format contig = np.ascontiguousarray(arr) - im.data = contig.tostring() + im.data = contig.tobytes() im.step = contig.strides[0] im.is_bigendian = ( arr.dtype.byteorder == '>' or