Skip to content

Commit 727c3f8

Browse files
BUG: arr.newbyteorder deprecation in numpy>2.0 (#1116)
Co-authored-by: Sebastian Wallkötter <sebastian@wallkoetter.net>
1 parent 37404a0 commit 727c3f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

imageio/plugins/_tifffile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,7 +3601,7 @@ def asarray(
36013601
if out is None and not result.dtype.isnative:
36023602
# swap byte order and dtype without copy
36033603
result.byteswap(True)
3604-
result = result.newbyteorder()
3604+
result = result.view(result.dtype.newbyteorder())
36053605
if lsb2msb:
36063606
reverse_bitorder(result)
36073607
else:
@@ -5074,7 +5074,7 @@ def read_array(
50745074
if native and not result.dtype.isnative:
50755075
# swap byte order and dtype without copy
50765076
result.byteswap(True)
5077-
result = result.newbyteorder()
5077+
result = result.view(result.dtype.newbyteorder())
50785078
return result
50795079

50805080
# Read data from file in chunks and copy to output array
@@ -7968,7 +7968,7 @@ def read_cz_sem(fh, byteorder, dtype, count, offsetsize):
79687968
def read_nih_image_header(fh, byteorder, dtype, count, offsetsize):
79697969
"""Read NIH_IMAGE_HEADER tag from file and return as dict."""
79707970
a = fh.read_record(TIFF.NIH_IMAGE_HEADER, byteorder=byteorder)
7971-
a = a.newbyteorder(byteorder)
7971+
a = a.view(a.dtype.newbyteorder(byteorder))
79727972
a = recarray2dict(a)
79737973
a["XUnit"] = a["XUnit"][: a["XUnitSize"]]
79747974
a["UM"] = a["UM"][: a["UMsize"]]

0 commit comments

Comments
 (0)