Jul-31-2020, 11:34 AM
Hi, I am getting an Attribute Error when using the PIL mage module. Not sure what the cause is as the no attribute of 'upper' is not written in the code, and when searching for similar errors, the missing attribute seems to be written in the code.
for file in glob.glob("*.png"): img = Image.open(file) rec = resizeimage.resize_crop(img, [200, 100]) filename = "rec_"+ file img.save(output + filename, rec)
Error:AttributeError Traceback (most recent call last)
<ipython-input-23-f08ed3820260> in <module>()
3 rec = resizeimage.resize_crop(img, [200, 100])
4 filename = "rec_"+ file
----> 5 img.save(output + filename, rec)
/usr/local/lib/python3.6/dist-packages/PIL/Image.py in save(self, fp, format, **params)
2084 raise ValueError("unknown file extension: {}".format(ext))
2085
-> 2086 if format.upper() not in SAVE:
2087 init()
2088 if save_all:
AttributeError: 'Image' object has no attribute 'upper'
What is the cause and solution to this error? Would be much appreciated.