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
|
continue
|
||||||
if item.media_type in OEB_RASTER_IMAGES:
|
if item.media_type in OEB_RASTER_IMAGES:
|
||||||
try:
|
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)
|
imdata = save_cover_data_to(item.data, compression_quality=70)
|
||||||
raw_data = as_base64_unicode(imdata)
|
raw_data = as_base64_unicode(imdata)
|
||||||
|
content_type = 'image/jpeg'
|
||||||
else:
|
else:
|
||||||
raw_data = as_base64_unicode(item.data)
|
raw_data = as_base64_unicode(item.data)
|
||||||
|
content_type = item.media_type
|
||||||
# Don't put the encoded image on a single line.
|
# Don't put the encoded image on a single line.
|
||||||
data = ''
|
data = ''
|
||||||
col = 1
|
col = 1
|
||||||
@ -321,7 +323,7 @@ class FB2MLizer(object):
|
|||||||
col = 1
|
col = 1
|
||||||
col += 1
|
col += 1
|
||||||
data += char
|
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:
|
except Exception as e:
|
||||||
self.log.error('Error: Could not include file %s because '
|
self.log.error('Error: Could not include file %s because '
|
||||||
'%s.' % (item.href, e))
|
'%s.' % (item.href, e))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user