Workaround for bug that affects some windows install causing white backgrounds on default covers to be rendered as yellow

This commit is contained in:
Kovid Goyal 2010-09-15 11:09:40 -06:00
parent bd98ca17b7
commit a20015e1e7
2 changed files with 6 additions and 6 deletions

View File

@ -194,7 +194,7 @@ class Image(_magick.Image): # {{{
# }}} # }}}
def create_canvas(width, height, bgcolor='white'): def create_canvas(width, height, bgcolor='#ffffff'):
canvas = Image() canvas = Image()
canvas.create_canvas(int(width), int(height), str(bgcolor)) canvas.create_canvas(int(width), int(height), str(bgcolor))
return canvas return canvas

View File

@ -11,7 +11,7 @@ from calibre.utils.magick import Image, DrawingWand, create_canvas
from calibre.constants import __appname__, __version__ from calibre.constants import __appname__, __version__
from calibre import fit_image from calibre import fit_image
def save_cover_data_to(data, path, bgcolor='white', resize_to=None, def save_cover_data_to(data, path, bgcolor='#ffffff', resize_to=None,
return_data=False): return_data=False):
''' '''
Saves image in data to path, in the format specified by the path Saves image in data to path, in the format specified by the path
@ -28,7 +28,7 @@ def save_cover_data_to(data, path, bgcolor='white', resize_to=None,
return canvas.export(os.path.splitext(path)[1][1:]) return canvas.export(os.path.splitext(path)[1][1:])
canvas.save(path) canvas.save(path)
def thumbnail(data, width=120, height=120, bgcolor='white', fmt='jpg'): def thumbnail(data, width=120, height=120, bgcolor='#ffffff', fmt='jpg'):
img = Image() img = Image()
img.load(data) img.load(data)
owidth, oheight = img.size owidth, oheight = img.size
@ -61,7 +61,7 @@ def identify(path):
return identify_data(data) return identify_data(data)
def add_borders_to_image(path_to_image, left=0, top=0, right=0, bottom=0, def add_borders_to_image(path_to_image, left=0, top=0, right=0, bottom=0,
border_color='white'): border_color='#ffffff'):
img = Image() img = Image()
img.open(path_to_image) img.open(path_to_image)
lwidth, lheight = img.size lwidth, lheight = img.size
@ -80,7 +80,7 @@ def create_text_wand(font_size, font_path=None):
ans.text_alias = True ans.text_alias = True
return ans return ans
def create_text_arc(text, font_size, font=None, bgcolor='white'): def create_text_arc(text, font_size, font=None, bgcolor='#ffffff'):
if isinstance(text, unicode): if isinstance(text, unicode):
text = text.encode('utf-8') text = text.encode('utf-8')
@ -148,7 +148,7 @@ class TextLine(object):
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='jpg'): bgcolor='#ffffff', output_format='jpg'):
''' '''
Create the standard calibre cover page and return it as a byte string in Create the standard calibre cover page and return it as a byte string in
the specified output_format. the specified output_format.