I'm currently writing a program that searches through an inputted folder and flags errors such as missing or empty files. One of the errors I need to check is if all of the .dpx images have the same resolution. However, I can't seem to find a way to check this. PIL can't open the file and I can't find a way to check the metadata. Any ideas?
This is the code I have for doing this at the moment:
im = Image.open(fullName)
if im.size != checkResolution:
numErrors += 1
reportMessages.append(ReportEntry(file, "WARNING",
"Unusual Resolution"))
fullName is the path to the file. checkResolution is the correct resolution as a tuple. reportMessages simply collects error strings to be printed in a report later. Running the program at the moment returns:
Traceback (most recent call last):
File "Program1V4", line 169, in <module>
main(sys.argv[1:])
File "Program1V4", line 108, in main
im = Image.open(fullName)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1983, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file