re-render a chunk if the image is corrupt
This commit is contained in:
9
chunk.py
9
chunk.py
@@ -103,6 +103,15 @@ class ChunkRenderer(object):
|
|||||||
dest_path = os.path.join(destdir, dest_filename)
|
dest_path = os.path.join(destdir, dest_filename)
|
||||||
|
|
||||||
if os.path.exists(dest_path):
|
if os.path.exists(dest_path):
|
||||||
|
# Try to open it to see if it's corrupt or something (can happen if
|
||||||
|
# the program crashed last time)
|
||||||
|
try:
|
||||||
|
testimg = Image.open(dest_path)
|
||||||
|
testimg.load()
|
||||||
|
except Exception:
|
||||||
|
# guess not, continue below
|
||||||
|
pass
|
||||||
|
else:
|
||||||
return dest_path
|
return dest_path
|
||||||
else:
|
else:
|
||||||
# Remove old images for this chunk
|
# Remove old images for this chunk
|
||||||
|
|||||||
Reference in New Issue
Block a user