Opened 5 years ago

Closed 5 years ago

#2815 closed defect (fixed)

Grass and Pillow > 3.0.0

Reported by: pmav99 Owned by: grass-dev@…
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:2 Changed 5 years ago by annakrat

Keywords: PIL added

Fixed in r67012. Please test.

comment:3 Changed 5 years ago by pmav99

Resolution: fixed
Status: newclosed

comment:4 in reply to:  3 Changed 5 years ago by neteler

Resolution: fixed
Status: closedreopened

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?

comment:5 Changed 5 years ago by annakrat

Resolution: fixed
Status: reopenedclosed

Backported in r67035.

Note: See TracTickets for help on using tickets.