diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 51bb84883b..2cf8a4296b 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -550,3 +550,10 @@ highlight_virtual_library = 'yellow' # all available output formats to be present. restrict_output_formats = None +#: Set the thumbnail image quality used by the content server +# The quality of a thumbnail is largely controlled by the compression quality +# used when creating it. Set this to a larger number to improve the quality. +# Note that the thumbnails get much larger with larger compression quality +# numbers. +# The value can be between 50 and 99 +content_server_thumbnail_compression_quality = 70 \ No newline at end of file diff --git a/src/calibre/library/server/content.py b/src/calibre/library/server/content.py index cdc569f8b7..0c0405aa50 100644 --- a/src/calibre/library/server/content.py +++ b/src/calibre/library/server/content.py @@ -18,6 +18,7 @@ from calibre.utils.magick.draw import (save_cover_data_to, Image, thumbnail as generate_thumbnail) from calibre.utils.filenames import ascii_filename from calibre.ebooks.metadata.opf2 import metadata_to_opf +from calibre.utils.config import tweaks plugboard_content_server_value = 'content_server' plugboard_content_server_formats = ['epub', 'mobi', 'azw3'] @@ -175,8 +176,13 @@ class ContentServer(object): cherrypy.response.headers['Last-Modified'] = self.last_modified(updated) if thumbnail: - return generate_thumbnail(cover, - width=thumb_width, height=thumb_height)[-1] + quality = tweaks['content_server_thumbnail_compression_quality'] + if quality < 50: + quality = 50 + elif quality > 99: + quality = 99 + return generate_thumbnail(cover, width=thumb_width, + height=thumb_height, compression_quality=quality)[-1] img = Image() img.load(cover)