mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
FB2 Output: Dont convert PNG images to JPEG as FB2 supports PNG
Fixes #1844911 [ebook-convert hangs when converting to FB2](https://bugs.launchpad.net/calibre/+bug/1844911)
This commit is contained in:
parent
d9ee5cc326
commit
0ed3a5e636
@ -307,11 +307,13 @@ class FB2MLizer(object):
|
||||
continue
|
||||
if item.media_type in OEB_RASTER_IMAGES:
|
||||
try:
|
||||
if item.media_type != 'image/jpeg':
|
||||
if item.media_type not in ('image/jpeg', 'image/png'):
|
||||
imdata = save_cover_data_to(item.data, compression_quality=70)
|
||||
raw_data = as_base64_unicode(imdata)
|
||||
content_type = 'image/jpeg'
|
||||
else:
|
||||
raw_data = as_base64_unicode(item.data)
|
||||
content_type = item.media_type
|
||||
# Don't put the encoded image on a single line.
|
||||
data = ''
|
||||
col = 1
|
||||
@ -321,7 +323,7 @@ class FB2MLizer(object):
|
||||
col = 1
|
||||
col += 1
|
||||
data += char
|
||||
images.append('<binary id="%s" content-type="image/jpeg">%s\n</binary>' % (self.image_hrefs[item.href], data))
|
||||
images.append('<binary id="%s" content-type="%s">%s\n</binary>' % (self.image_hrefs[item.href], content_type, data))
|
||||
except Exception as e:
|
||||
self.log.error('Error: Could not include file %s because '
|
||||
'%s.' % (item.href, e))
|
||||
|
Loading…
x
Reference in New Issue
Block a user