mirror of
https://github.com/ciromattia/kcc
synced 2025-12-12 17:26:23 +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:
@@ -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=\"" +
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user