Line 0
Link Here
|
|
|
1 |
From c843f3664064742e2672e0fea528571a882d84ad Mon Sep 17 00:00:00 2001 |
2 |
From: Eli Schwartz <eschwartz93@gmail.com> |
3 |
Date: Fri, 5 Apr 2019 11:28:45 -0400 |
4 |
Subject: [PATCH] PIL: remove unnnecessary version check and code fork (#8496) |
5 |
|
6 |
The Image.VERSION variable was deprecated some time ago and is now gone |
7 |
entirely. But its only use was to determine whether we were using at |
8 |
least the latest version of PIL, or any version of its fork, Pillow. And |
9 |
PIL was last developed in 2009 and does not support python3 at all, so |
10 |
we are guaranteed to be using Pillow. |
11 |
|
12 |
Moreover, the check does not really matter, as Pillow is guaranteed to |
13 |
load any image it opens, without the user doing so manually. |
14 |
|
15 |
Fixes #8495 |
16 |
|
17 |
--- files/usr/lib/cinnamon-settings/bin/imtools.py.orig 2019-05-23 10:40:29 UTC |
18 |
+++ files/usr/lib/cinnamon-settings/bin/imtools.py |
19 |
@@ -618,32 +618,6 @@ def has_transparency(image): |
20 |
return (image.mode == 'P' and 'transparency' in image.info) or\ |
21 |
has_alpha(image) |
22 |
|
23 |
- |
24 |
-if Image.VERSION == '1.1.7': |
25 |
- |
26 |
- def split(image): |
27 |
- """Work around for bug in Pil 1.1.7 |
28 |
- |
29 |
- :param image: input image |
30 |
- :type image: PIL image object |
31 |
- :returns: the different color bands of the image (eg R, G, B) |
32 |
- :rtype: tuple |
33 |
- """ |
34 |
- image.load() |
35 |
- return image.split() |
36 |
-else: |
37 |
- |
38 |
- def split(image): |
39 |
- """Work around for bug in Pil 1.1.7 |
40 |
- |
41 |
- :param image: input image |
42 |
- :type image: PIL image object |
43 |
- :returns: the different color bands of the image (eg R, G, B) |
44 |
- :rtype: tuple |
45 |
- """ |
46 |
- return image.split() |
47 |
- |
48 |
- |
49 |
def get_alpha(image): |
50 |
"""Gets the image alpha band. Can handles P mode images with transpareny. |
51 |
Returns a band with all values set to 255 if no alpha band exists. |
52 |
@@ -654,7 +628,7 @@ def get_alpha(image): |
53 |
:rtype: single band image object |
54 |
""" |
55 |
if has_alpha(image): |
56 |
- return split(image)[-1] |
57 |
+ return image.split()[-1] |
58 |
if image.mode == 'P' and 'transparency' in image.info: |
59 |
return image.convert('RGBA').split()[-1] |
60 |
# No alpha layer, create one. |