To work around Espen's corrupted image bug, we simply try to copy the image twice. The second time will usually work, unless the file is totally borked.
parent
76b43690f2
commit
6d75a3ed64
|
@ -207,7 +207,14 @@ class Photo(object):
|
||||||
if os.path.exists(thumb_path) and file_mtime(thumb_path) >= self._attributes["dateTimeFile"]:
|
if os.path.exists(thumb_path) and file_mtime(thumb_path) >= self._attributes["dateTimeFile"]:
|
||||||
return
|
return
|
||||||
gc.collect()
|
gc.collect()
|
||||||
image = image.copy()
|
try:
|
||||||
|
image = image.copy()
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
image = image.copy() # we try again to work around PIL bug
|
||||||
|
except:
|
||||||
|
print "Image is corrupted. %s will not be created." % thumb_path
|
||||||
|
return
|
||||||
if square:
|
if square:
|
||||||
if image.size[0] > image.size[1]:
|
if image.size[0] > image.size[1]:
|
||||||
left = (image.size[0] - image.size[1]) / 2
|
left = (image.size[0] - image.size[1]) / 2
|
||||||
|
|
Loading…
Reference in New Issue