I'm trying to open a TIF using PIL and create a draw object. Opening the image works just fine but when creating the draw object, the program stalls for about 2 seconds then exits without an error.
My system is Windows 10. I created an anaconda environment with:
I ran the following commands:
>>> import os
>>> from PIL import Image, ImageDraw
>>> img_path = os.path.join('path', 'to', 'image.tif')
>>> os.path.isfile(img_path)
True
>>> im = Image.open(img_path)
>>> draw = ImageDraw.Draw(im)
The ImageDraw.Draw causes the program to exit without any error.
One image on which I had this problem is accessible via WeTransfer. I had this problem using multiple tifs, I also tried changing the file extension to tiff and it didn't work. I converted the tifs to pngs and the code worked just fine.
I figured it out. Updating the conda package to pillow=9.2.0 didn't work so I used pip instead to download pillow=9.3.0 (pip install Pillow
). That solved my problem.