mirror of
https://github.com/ciromattia/kcc
synced 2026-06-01 12:13:12 +00:00
Merge branch 'new-gui' of github.com:ciromattia/kcc into new-gui
This commit is contained in:
+7
-7
@@ -130,23 +130,23 @@ class ComicPage:
|
|||||||
self.image = Image.open(source)
|
self.image = Image.open(source)
|
||||||
self.image = self.image.convert('RGB')
|
self.image = self.image.convert('RGB')
|
||||||
|
|
||||||
def saveToDir(self, targetdir, forcepng, color, wipe, sufix=None):
|
def saveToDir(self, targetdir, forcepng, color, wipe, suffix=None):
|
||||||
filename = os.path.basename(self.origFileName)
|
filename = os.path.basename(self.origFileName)
|
||||||
try:
|
try:
|
||||||
if not color:
|
if not color:
|
||||||
self.image = self.image.convert('L') # convert to grayscale
|
self.image = self.image.convert('L') # convert to grayscale
|
||||||
if sufix == "R":
|
if suffix == "R":
|
||||||
sufix = "_kccrotated"
|
suffix = "_kccrotated"
|
||||||
else:
|
else:
|
||||||
sufix = ""
|
suffix = ""
|
||||||
if wipe:
|
if wipe:
|
||||||
os.remove(os.path.join(targetdir, filename))
|
os.remove(os.path.join(targetdir, filename))
|
||||||
else:
|
else:
|
||||||
sufix += "_kcchq"
|
suffix += "_kcchq"
|
||||||
if forcepng:
|
if forcepng:
|
||||||
self.image.save(os.path.join(targetdir, os.path.splitext(filename)[0] + sufix + ".png"), "PNG")
|
self.image.save(os.path.join(targetdir, os.path.splitext(filename)[0] + suffix + ".png"), "PNG")
|
||||||
else:
|
else:
|
||||||
self.image.save(os.path.join(targetdir, os.path.splitext(filename)[0] + sufix + ".jpg"), "JPEG")
|
self.image.save(os.path.join(targetdir, os.path.splitext(filename)[0] + suffix + ".jpg"), "JPEG")
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
raise RuntimeError('Cannot write image in directory %s: %s' % (targetdir, e))
|
raise RuntimeError('Cannot write image in directory %s: %s' % (targetdir, e))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user