1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

restore imgMetadata dict (#858)

* Revert "memory optimization: store metadata in filenames, not a global dict (…"

This reverts commit 9a2a09eab9.

* only remove imgOld
This commit is contained in:
Alex Xu
2025-03-11 09:57:11 -07:00
committed by GitHub
parent b8b7926366
commit 561951a349
2 changed files with 14 additions and 8 deletions

View File

@@ -299,12 +299,13 @@ class ComicPage:
def saveToDir(self):
try:
flags = []
if not self.opt.forcecolor and not self.opt.forcepng:
self.image = self.image.convert('L')
if self.rotated:
self.targetPath += '-Rotated'
flags.append('Rotated')
if self.fill != 'white':
self.targetPath += '-BlackBackground'
flags.append('BlackBackground')
if self.opt.forcepng:
self.image.info["transparency"] = None
self.targetPath += '.png'
@@ -322,7 +323,7 @@ class ComicPage:
self.image.save(self.targetPath, 'JPEG', optimize=1, quality=85)
if os.path.isfile(self.orgPath):
os.remove(self.orgPath)
return Path(self.targetPath).name
return [Path(self.targetPath).name, flags]
except IOError as err:
raise RuntimeError('Cannot save image. ' + str(err))