PIL or Pillow installation issues and PNG metadata



  • Hello. I am looking to edit/append metadata to exported png files from Drawbot. After doing some research, it looks like the pillow PIL library can do something like this:

    from PIL import image
    targetImage = Image.open("testimage.png")
    targetImage.info["MyNewString"] = "A string"
    targetImage.info["MyNewInt"] = 1234
    targetImage.save("test images/addedData.png")
    

    But I tried to install pillow through the Drawbot "Install Python Packages..." terminal and it looks like it installed successfully, but when I run the "from PIL import image" line in my code, it gives me the following error:

    ImportError: cannot import name 'image' from 'PIL' (/Users/username/Library/Application Support/DrawBot/Python3.7/PIL/init.py)

    That is the correct directory where it should be looking. Interestingly enough if I go outside Drawbot to Mac Terminal, then run the python version command (python3 -V), it says I am running Python 3.8.9. Strange because I can't find any evidence on my machine that version 3.8.9 is installed. Does anyone have any ideas on what the issue could be? Many thanks in advance for any help.


  • admin

    what version of drawBot do you use?

    PIL (pillow) is embedded now as a package inside the app bundle.



  • Running Drawbot 3.128.



  • @rduritsa said in PIL or Pillow installation issues and PNG metadata:

    from PIL import image

    Shouldn’t that be Image instead of image?


Log in to reply