projects/guix·blob java-team · refs

20 lines · 783 B

1From 9d8daba419249f9d3327fe85177d79b18adb6032 Mon Sep 17 00:00:00 2001
2From: Stefan van der Walt <[email protected]>
3Date: Thu, 8 Jan 2026 03:39:36 -0800
4Subject: [PATCH] Handle PIL Image.getdata deprecation (#8010)
5
6diff --git a/src/skimage/io/_plugins/pil_plugin.py b/src/skimage/io/_plugins/pil_plugin.py
7index 7a75c5fc0af..098d22a148e 100644
8--- a/src/skimage/io/_plugins/pil_plugin.py
9+++ b/src/skimage/io/_plugins/pil_plugin.py
10@@ -47,6 +47,10 @@ def pil_to_ndarray(image, dtype=None, img_num=None):
11 Refer to ``imread``.
12
13 """
14+ # PIL 12.1.0 renames getdata
15+ if hasattr(image, "get_flattened_data"):
16+ image.getdata = image.get_flattened_data
17+
18 try:
19 # this will raise an IOError if the file is not readable
20 image.getdata()[0]