mirror of
https://github.com/ciromattia/kcc
synced 2025-12-24 07:01:51 +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")
|
".xhtml\" media-type=\"application/xhtml+xml\"/>\n")
|
||||||
if '.png' == filename[1]:
|
if '.png' == filename[1]:
|
||||||
mt = 'image/png'
|
mt = 'image/png'
|
||||||
|
elif '.gif' == filename[1]:
|
||||||
|
mt = 'image/gif'
|
||||||
else:
|
else:
|
||||||
mt = 'image/jpeg'
|
mt = 'image/jpeg'
|
||||||
f.write("<item id=\"img_" + str(uniqueid) + "\" href=\"" + folder + "/" + path[1] + "\" media-type=\"" +
|
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):
|
def save_with_codec(self, image, targetPath):
|
||||||
if self.opt.forcepng:
|
if self.opt.forcepng:
|
||||||
image.info["transparency"] = None
|
image.info["transparency"] = None
|
||||||
targetPath += '.png'
|
if self.opt.iskindle and ('MOBI' in self.opt.format or 'EPUB' in self.opt.format):
|
||||||
image.save(targetPath, 'PNG', optimize=1)
|
targetPath += '.gif'
|
||||||
|
image.save(targetPath, 'GIF', optimize=1, interlace=False)
|
||||||
|
else:
|
||||||
|
targetPath += '.png'
|
||||||
|
image.save(targetPath, 'PNG', optimize=1)
|
||||||
else:
|
else:
|
||||||
targetPath += '.jpg'
|
targetPath += '.jpg'
|
||||||
if self.opt.mozjpeg:
|
if self.opt.mozjpeg:
|
||||||
|
|||||||
Reference in New Issue
Block a user