EPUB Output: Default cover is generated is now generated as a JPEG, reducing size by an order of magnitude. Fixes #5810 (0.7.2 creating larger epubs from RTF)

This commit is contained in:
Kovid Goyal 2010-06-12 16:42:21 -06:00
parent 10b0d7647b
commit 0d66fe64cf
2 changed files with 3 additions and 3 deletions

View File

@ -103,8 +103,8 @@ class CoverManager(object):
32)] 32)]
img_data = create_cover_page(lines, I('library.png')) img_data = create_cover_page(lines, I('library.png'))
id, href = self.oeb.manifest.generate('cover_image', id, href = self.oeb.manifest.generate('cover_image',
'cover_image.png') 'cover_image.jpg')
item = self.oeb.manifest.add(id, href, guess_type('t.png')[0], item = self.oeb.manifest.add(id, href, guess_type('t.jpg')[0],
data=img_data) data=img_data)
m.clear('cover') m.clear('cover')
m.add('cover', item.id) m.add('cover', item.id)

View File

@ -175,7 +175,7 @@ def add_borders_to_image(path_to_image, left=0, top=0, right=0, bottom=0,
p.DestroyMagickWand(canvas) p.DestroyMagickWand(canvas)
def create_cover_page(top_lines, logo_path, width=590, height=750, def create_cover_page(top_lines, logo_path, width=590, height=750,
bgcolor='white', output_format='png'): bgcolor='white', output_format='jpg'):
ans = None ans = None
with p.ImageMagick(): with p.ImageMagick():
canvas = create_canvas(width, height, bgcolor) canvas = create_canvas(width, height, bgcolor)