From d5d9ac8bb0aaf836d1670b4992ec9d247f0593cb Mon Sep 17 00:00:00 2001 From: Ailing Zhang Date: Tue, 27 Sep 2022 13:49:54 +0800 Subject: [PATCH] [bug] Relax dependent Pillow version Fixes #6032 --- python/taichi/lang/_texture.py | 5 +++-- requirements_test.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python/taichi/lang/_texture.py b/python/taichi/lang/_texture.py index 263eef3c147b9..46dfd1a66bb81 100644 --- a/python/taichi/lang/_texture.py +++ b/python/taichi/lang/_texture.py @@ -161,7 +161,8 @@ def from_image(self, image): assert self.num_dims == 2 assert self.dtype == u8 assert self.num_channels == 4 - image = image.transpose(Image.Transpose.ROTATE_90) + # Don't use transpose method since its enums are too new + image = image.rotate(90, expand=True) arr = np.asarray(image) from taichi._kernels import \ load_texture_from_numpy # pylint: disable=import-outside-toplevel @@ -181,4 +182,4 @@ def to_image(self): from taichi._kernels import \ save_texture_to_numpy # pylint: disable=import-outside-toplevel save_texture_to_numpy(self, res) - return Image.fromarray(res).transpose(Image.TRANSPOSE.ROTATE_270) + return Image.fromarray(res).rotate(270, expand=True) diff --git a/requirements_test.txt b/requirements_test.txt index 44c088fc8cbe6..d04ec07a9d72a 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,4 @@ -Pillow>=9.1.0 +Pillow pytest pytest-xdist pytest-rerunfailures