Bug#808279: Patch for python-pil bug #808238
Eric Soroos
eric-debian at soroos.net
Fri Dec 18 10:16:16 UTC 2015
Package: tilestache
Version: 1.49.8-1
Severity: normal
This is a fix for bug #808238 from Python-pil
Tilestache uses PIL.Image.fromstring, which has been deprecated in
Pillow since 2.0.0, and has now been removed in 3.0.0.
Patch follows:
diff --git a/TileStache/Mapnik.py b/TileStache/Mapnik.py
index 24120a8..64d74bf 100644
--- a/TileStache/Mapnik.py
+++ b/TileStache/Mapnik.py
@@ -128,7 +128,12 @@ class ImageProvider:
# always release the lock
global_mapnik_lock.release()
- img = Image.fromstring('RGBA', (width, height), img.tostring())
+ if hasattr(Image, 'frombytes'):
+ # Image.fromstring is deprecated past Pillow 2.0
+ img = Image.frombytes('RGBA', (width, height), img.tostring())
+ else:
+ # PIL still uses Image.fromstring
+ img = Image.fromstring('RGBA', (width, height), img.tostring()
logging.debug('TileStache.Mapnik.ImageProvider.renderArea()
%dx%d in %.3f from %s', width, height, time() - start_time, self.mapfile)
diff --git a/TileStache/Pixels.py b/TileStache/Pixels.py
index d17faa0..bfebbb0 100644
--- a/TileStache/Pixels.py
+++ b/TileStache/Pixels.py
@@ -100,7 +100,13 @@ def apply_palette(image, palette, t_index):
indexes.append(mapping[(r, g, b)])
- output = Image.fromstring('P', image.size, ''.join(indexes))
+ if hasattr(Image, 'frombytes'):
+ # Image.fromstring is deprecated past Pillow 2.0
+ output = Image.frombytes('P', image.size, ''.join(indexes))
+ else:
+ # PIL still uses Image.fromstring
+ output = Image.fromstring('P', image.size, ''.join(indexes))
+
bits = int(ceil(log(len(palette)) / log(2)))
palette += [(0, 0, 0)] * (256 - len(palette))
More information about the Pkg-grass-devel
mailing list