I'm doing a system of change of avatar using the Python Imaging Library, but I'm having problem in following error presented:
client.changeAvatar(data)
  File "C:\Users\Administrator\Desktop\Main.py", line 332, in changeAvatar
    iM = i.resize((100, 100), Image.ANTIALIAS)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1262, in resize
    self.load()
  File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 192, in load
    raise IOError("image file is truncated (%d bytes not processed)" % len(b))
exceptions.IOError: image file is truncated (13 bytes not processed)
Code:
    with open("%i.jpg" %(self.playerID), "wb") as f:
        f.write(data)
    i = Image.open("%i.jpg" %(self.playerID))
    iM = i.resize((100, 100), Image.ANTIALIAS)
    iM.save("%i.jpg" %(self.playerID))
    im = i.resize((50, 50), Image.ANTIALIAS)
    im.save("%i_50.jpg" %(self.playerID))
    F = ftplib.FTP("", "", "")
    cdTree("/public_html/avatar/%s"%(self.playerID))
    for name in ["%i.jpg" %(self.playerID), "%i_50.jpg" %(self.playerID)]:
        with open(name, "rb") as fp:
            F.storbinary("STOR public_html/avatar/%s/%s" %(self.playerID, name), fp)
        os.system("del %s" %(name))
    F.quit()
Can anyone help me solve this error?