[GRASS-dev] [GRASS GIS] #2815: Grass and Pillow > 3.0.0
GRASS GIS
trac at osgeo.org
Wed Dec 2 10:48:56 PST 2015
#2815: Grass and Pillow > 3.0.0
-------------------------+-------------------------
Reporter: pmav99 | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.3
Component: wxGUI | Version:
Keywords: animation | CPU: All
Platform: Unspecified |
-------------------------+-------------------------
Pillow since version 3.0.0 removed the `fromstring()` method[1]. AFAIK the
only usage of the `fromstring()` method in GRASS in g.gui.animation:
{{{
$ ag fromstring
[omit etree.fromstring() results]
gui/wxpython/animation/utils.py
263: pilImage.fromstring(image.GetData())
}}}
I believe it is rather safe to replace the call with `frombytes()`. If we
need to keep compatibility with the original PIL I guess that something
like this would do it:
{{{
def WxImageToPil(image):
"""Converts wx.Image to PIL image"""
pilImage = Image.new('RGB', (image.GetWidth(), image.GetHeight()))
try:
pilImage.frombytes(image.GetData())
except Exception:
# We are using the original Pil or an old Pillow version
pilImage.fromstring(image.GetData())
return pilImage
}}}
[1] https://github.com/python-
pillow/Pillow/commit/71c95c8e5f3bba1845444a246d04646825e6bab3
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2815>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list