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

Save images in GIF when output is set to MOBI and forcepng is used (#981)

* Save images in GIF when output is set to MOBI and forcepng option is used

* Save images in GIF when output is set to EPUB, kindle profile is used and forcepng option is set

* media-type="image/gif"

---------

Co-authored-by: Alex Xu <alexkurosakimh3@gmail.com>
This commit is contained in:
Adrian
2025-06-25 08:14:00 +03:00
committed by GitHub
parent 2ecbf7d2e9
commit 217a18b7b5
2 changed files with 8 additions and 2 deletions

View File

@@ -336,6 +336,8 @@ def buildOPF(dstdir, title, filelist, cover=None):
".xhtml\" media-type=\"application/xhtml+xml\"/>\n")
if '.png' == filename[1]:
mt = 'image/png'
elif '.gif' == filename[1]:
mt = 'image/gif'
else:
mt = 'image/jpeg'
f.write("<item id=\"img_" + str(uniqueid) + "\" href=\"" + folder + "/" + path[1] + "\" media-type=\"" +

View File

@@ -325,8 +325,12 @@ class ComicPage:
def save_with_codec(self, image, targetPath):
if self.opt.forcepng:
image.info["transparency"] = None
targetPath += '.png'
image.save(targetPath, 'PNG', optimize=1)
if self.opt.iskindle and ('MOBI' in self.opt.format or 'EPUB' in self.opt.format):
targetPath += '.gif'
image.save(targetPath, 'GIF', optimize=1, interlace=False)
else:
targetPath += '.png'
image.save(targetPath, 'PNG', optimize=1)
else:
targetPath += '.jpg'
if self.opt.mozjpeg: