mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
[SBNOutput] Use jpg instead of png.
This commit is contained in:
parent
29e133c61a
commit
3ec09a3b40
@ -160,7 +160,7 @@ class SNBOutput(OutputFormatPlugin):
|
||||
mergeLast = False
|
||||
lastName = None
|
||||
for item in s:
|
||||
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_IMAGES, PNG_MIME
|
||||
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_IMAGES
|
||||
if m.hrefs[item.href].media_type in OEB_DOCS:
|
||||
if not item.href in outputFiles:
|
||||
log.debug('File %s is unused in TOC. Continue in last chapter' % item.href)
|
||||
@ -203,13 +203,8 @@ class SNBOutput(OutputFormatPlugin):
|
||||
if m.hrefs[item.href].media_type in OEB_IMAGES:
|
||||
log.debug('Converting image: %s ...' % item.href)
|
||||
content = m.hrefs[item.href].data
|
||||
if m.hrefs[item.href].media_type != PNG_MIME:
|
||||
# Convert & Resize image
|
||||
self.HandleImage(content, os.path.join(snbiDir, ProcessFileName(item.href)))
|
||||
else:
|
||||
outputFile = open(os.path.join(snbiDir, ProcessFileName(item.href)), 'wb')
|
||||
outputFile.write(content)
|
||||
outputFile.close()
|
||||
|
||||
# Package as SNB File
|
||||
snbFile = SNBFile()
|
||||
|
@ -23,10 +23,10 @@ def ProcessFileName(fileName):
|
||||
fileName = fileName.replace("#", "_")
|
||||
# Make it lower case
|
||||
fileName = fileName.lower()
|
||||
# Change extension from jpeg to jpg
|
||||
# Change all images to jpg
|
||||
root, ext = os.path.splitext(fileName)
|
||||
if ext in [ '.jpeg', '.jpg', '.gif', '.svg' ]:
|
||||
fileName = root + '.png'
|
||||
fileName = root + '.jpg'
|
||||
return fileName
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user