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