forked from indymedia/epicyon
Handle failure to open image
This commit is contained in:
1 parent
65227e7c59
commit
a21b7fd958
1 file changed
+5
-1
@@ -19,10 +19,14 @@ from shutil import copyfile
|
||||
from shutil import rmtree
|
||||
from shutil import move
|
||||
|
||||
def removeMetaData(imageFilename: str,outputFilename: str):
|
||||
def removeMetaData(imageFilename: str,outputFilename: str) -> None:
|
||||
imageFile = open(imageFilename)
|
||||
image = Image.open(imageFilename)
|
||||
if not image:
|
||||
return
|
||||
data = list(image.getdata())
|
||||
if not data:
|
||||
return
|
||||
imageWithoutExif = Image.new(image.mode, image.size)
|
||||
imageWithoutExif.putdata(data)
|
||||
imageWithoutExif.save(outputFilename)
|
||||
|
||||
Reference in new issue
Block a user