Opened 9 years ago
Closed 9 years ago
#2815 closed defect (fixed)
Grass and Pillow > 3.0.0
Reported by: | pmav99 | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.3 |
Component: | wxGUI | Version: | unspecified |
Keywords: | animation, PIL | Cc: | |
CPU: | All | Platform: | Unspecified |
Description
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
Change History (5)
comment:1 by , 9 years ago
Version: | → unspecified |
---|
follow-up: 4 comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Replying to pmav99:
Resolution set to fixed Status changed from new to closed
Didn't you want the fix also in 7.0? The backport has not happened yet, so please don't close the ticket yet. Or is no backport wanted?
This should be the exact same issue: http://osgeo-org.1560.x6.nabble.com/d-mon-using-PIL-tostring-not-used-anymore-tobytes-to-be-used-td5239514.html