This commit is contained in:
Kovid Goyal 2011-07-16 20:29:04 -06:00
parent ba77c55764
commit 0c8641faa1
4 changed files with 7 additions and 5 deletions

View File

@ -111,7 +111,8 @@ def align_block(raw, multiple=4, pad='\0'):
def rescale_image(data, maxsizeb, dimen=None):
if dimen is not None:
data = thumbnail(data, width=dimen, height=dimen)[-1]
data = thumbnail(data, width=dimen[0], height=dimen[1],
compression_quality=90)[-1]
else:
# Replace transparent pixels with white pixels and convert to JPEG
data = save_cover_data_to(data, 'img.jpg', return_data=True)

View File

@ -407,7 +407,7 @@ If you are worried that someday |app| will cease to be developed, leaving all yo
Since I keep getting asked why there are numbers at the end of the title folder name, the reason is for *robustness*. That number is the id number of the book record in the |app| database. The presence of the number allows you to have multiple records with the same title and author names. More importantly, it is part of what allows |app| to magically regenerate the database with all metadata if the database file gets corrupted. Given that |app|'s mission is to get you to stop storing metadata in filenames and stop using the filesystem to find things, the increased robustness afforded by the id numbers is well worth the uglier folder names.
Finally, if you are irrevocably wedded to the filesystem, feel free to patch your local copy of |app| to use whatever storage scheme you like. But, do not bother me with requests to change the directory structure, **they will be ignored**.
Finally, if you are irrevocably wedded to using the filesystem to store your metadata, feel free to patch your local copy of |app| to use whatever storage scheme you like. But, do not bother me with requests to change the directory structure, **they will be ignored**.
Why doesn't |app| have a column for foo?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -104,7 +104,8 @@ The :guilabel:`Convert books` action has three variations, accessed by the arrow
This allows you to use the search features to limit the books to be catalogued. In addition, if you select multiple books using the mouse,
only those books will be added to the catalog. If you generate the catalog in an ebook format such as EPUB or MOBI,
the next time you connect your ebook reader the catalog will be automatically sent to the device.
For more information on how catalogs work, read the `catalog creation tutorial <http://www.mobileread.com/forums/showthread.php?p=755468#post755468>`_at MobileRead.
For more information on how catalogs work, read the `catalog creation tutorial <http://www.mobileread.com/forums/showthread.php?p=755468#post755468>`_
at MobileRead.
.. _view:

View File

@ -107,7 +107,7 @@ def save_cover_data_to(data, path, bgcolor='#ffffff', resize_to=None,
return ret
def thumbnail(data, width=120, height=120, bgcolor='#ffffff', fmt='jpg',
preserve_aspect_ratio=True):
preserve_aspect_ratio=True, compression_quality=70):
img = Image()
img.load(data)
owidth, oheight = img.size
@ -122,7 +122,7 @@ def thumbnail(data, width=120, height=120, bgcolor='#ffffff', fmt='jpg',
canvas = create_canvas(img.size[0], img.size[1], bgcolor)
canvas.compose(img)
if fmt == 'jpg':
canvas.set_compression_quality(70)
canvas.set_compression_quality(compression_quality)
return (canvas.size[0], canvas.size[1], canvas.export(fmt))
def identify_data(data):