Converting PNG (GIF?) images to full RGBA PNG images seems to fix the problem.
I put this code after removing the ‘failed’ images:
for o in bear_types:
# convert all PNG, GIF images to RGBA
for image in os.listdir(path/o):
ext = os.path.splitext(image)[1]
if ext in ['.png', '.gif']:
new_filename = os.path.splitext(image)[0]+'.png'
img = Image.open(path/o/image)
img.convert('RGBA')
img.save(new_filename)
print('saving: ' + new_filename)
I used this topic for reference: