1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Wed, 10 Sep 2025 06:35:50 +0000
Subject: numpy-2.3-compat
---
libtiff/lzw.py | 4 ++--
libtiff/scripts/convert.py | 2 +-
libtiff/tiff_file.py | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libtiff/lzw.py b/libtiff/lzw.py
index 64f2561..e2e0459 100644
--- a/libtiff/lzw.py
+++ b/libtiff/lzw.py
@@ -39,7 +39,7 @@ def encode_bitarray(seq, max_bits=12):
decode_bitarray
"""
if isinstance(seq, numpy.ndarray):
- seq = seq.tostring()
+ seq = seq.tobytes()
r = bitarray(0, endian='little')
write = r.fromword
@@ -105,7 +105,7 @@ def encode_bittools(seq, max_bits=12):
"""
if isinstance(seq, numpy.ndarray):
nbytes = seq.nbytes * 2
- seq = seq.tostring()
+ seq = seq.tobytes()
else:
nbytes = len(seq) * 2
r = numpy.zeros((nbytes,), dtype=numpy.ubyte)
diff --git a/libtiff/scripts/convert.py b/libtiff/scripts/convert.py
index 8ed37ff..574747d 100644
--- a/libtiff/scripts/convert.py
+++ b/libtiff/scripts/convert.py
@@ -51,7 +51,7 @@ def runner(parser, options, args):
for ifd in tiff.IFD:
s = ifd.get('ImageDescription')
if s is not None:
- description.append(s.value.tostring())
+ description.append(s.value.tobytes())
init_description = '\n'.join(description)
samples_list, names_list = tiff.get_samples()
while samples_list:
diff --git a/libtiff/tiff_file.py b/libtiff/tiff_file.py
index 347fb63..a38b597 100644
--- a/libtiff/tiff_file.py
+++ b/libtiff/tiff_file.py
@@ -247,7 +247,7 @@ class TIFFfile(TiffBase):
while self.data[offset + i]:
i += 1
length = i
- string = self.get_values(offset, 'BYTE', length).tostring()
+ string = self.get_values(offset, 'BYTE', length).tobytes()
return string
def check_memory_usage(self, verbose=True):
@@ -792,7 +792,7 @@ class IFD:
'DocumentName', 'Model', 'Make', 'PageName',
'DateTime', 'Artist', 'HostComputer']:
if value is not None:
- return value.view('|S{!s}'.format(str(value.nbytes // value.size))).tostring()
+ return value.view('|S{!s}'.format(str(value.nbytes // value.size))).tobytes()
if human:
if tag_name == 'Compression':
value = {1: 'Uncompressed', 2: 'CCITT1D', 3: 'Group3Fax',
|