1
0
mirror of https://github.com/ciromattia/kcc synced 2026-01-09 23:09:43 +00:00

Improved detection of corrupted files

This commit is contained in:
Paweł Jastrzębski
2013-08-11 12:58:34 +02:00
parent 5e7ae73861
commit d3e0c2bb6e

View File

@@ -120,9 +120,16 @@ class ComicPage:
raise RuntimeError('Cannot read image file %s' % source)
# Detect corrupted files - Phase 3
try:
self.image = Image.open(source)
self.image.verify()
except:
raise RuntimeError('Image file %s is corrupted' % source)
# Detect corrupted files - Phase 4
try:
self.image = Image.open(source)
self.image.load()
except:
raise RuntimeError('Image file %s is corrupted' % source)
self.image = Image.open(source)
self.image = self.image.convert('RGB')