[GUI Plugin] Generate Cover
#1  kiwidude 03-04-2011, 07:12 PM
Users will often have books in their collection for which there is no official cover available to download, such as short fiction and articles. Calibre includes the ability to generate a cover for you from the book metadata. However currently the only control over its appearance it offers is a tweak for the font.

This plugin offers an enhanced alternative that allows you to select from your own choice of cover images and a wide range of layout/appearance options.

Main Features:
Special Notes:
Installation Steps:
  1. Download the attached zip file and install the plugin/add to context menu or toolbar/restart Calibre as described in the Introduction to plugins thread.
  2. Select the book(s) you want to generate a cover for, and select the Generate Cover menu option or toolbar button you have configured in step 1. The configuration dialog as per the screenshot will open allowing you to import images and alter appearance.

Paypal Donations:
Sample Cover Settings:
Version History:
Spoiler Warning below

Version 2.1.0 - 21 Jan 2022
- Changes for upcoming Qt6 Calibre

Version 2.0.2 - 06 Feb 2021
- Fix for a py2/py3 difference in import zip

Version 2.0.1 - 04 Dec 2020
- Fix image centering again

Version 2.0.0 - 07 Nov 2020
- Fix for border causing image to move horizontally.
- Remove, not needed in Cal v2+ - min valid calibre is v2.85.1
- French translation - thanks un-pogaz!
- Spanish translation - thanks dunhill!

Version 1.5.25 - 12 Jun 2020
- GC: custom text setText() instead of setHtml()

Version 1.5.24 - 21 May 2020
Explicitly enforces the image size limits when read from the file, not just on the spin box in the dialog (and outputs a little debug data).

Version 1.5.22 - 16 Jan 2020
Compatibility with Python 3

Version 1.5.21 - 31 July 2016
Fix a regression in the previous release that broke integration with the FanFicFare plugin

Version 1.5.20 - 29 July 2016
Fix incorrect handling of book with multiple authors (extra spaces inserted around &)
Also use the correct calibre APIs to read the cover from the database.

Version 1.5.19 - 21 May 2016
Fix inability to use first font in the list of fonts for rendering text

Version 1.5.18 - 20 May 2016
Compatibility for calibre 2.57+

Version 1.5.16 - 11 Oct 2014
Compatibility for calibre 2.4+

Version 1.5.15 - 15 Jul 2014
Compatibility for the upcoming calibre 2.0

Version 1.5.14 - 29 Sep 2013
Fix for the user typing \n or or <br> or <br/> as part of the author to control split across multiple lines

Version 1.5.13 - 24 Sep 2013
Support the user typing \n or or <br> or <br/> as part of the title or series to control split across multiple lines
Add a checkbox option to allow scaling up the cover image to fit the available area if it is too small.

Version 1.5.12 - 03 May 2013
Fix for change made to calibre API in 0.9.29

Version 1.5.11 - 17 Mar 2012
Fix bug of import saved cover settings not working

Version 1.5.10 - 06 Mar 2013
Re-release of 1.5.9 due to problem with zip file

Version 1.5.9 - 06 Mar 2013
Add a "Metadata" section to the "Content" tab allowing the user to override title/author/series for one-off covers
Add ability to configure a custom column (or tags column) to contain a value any time a cover is generated for a book

Version 1.5.8 - 09 Dec 2012
Automatically "correct" any corrupted json files when users upgrade to this version
Check for corruption every time Generate Cover is opened. If found, show error dialog and autofix.
Prevent plugin being used in Device View or on Device View context menu

Version 1.5.7 - 14 Nov 2012
Fix bug in stretch cover/resize option not finding full path to image.

Version 1.5.6 - 03 Nov 2012
Add support for calibre 0.9.5 which changed how Fonts are loaded.

Version 1.5.5 - 14 Aug 2012
No longer use a calibre ImageView to preview cover as it has right-click menu and drag/drop not relevant to this plugin
Add protection against failed upgrades of the seriesText field.

Version 1.5.4 - 01 Jun 2012
Make the series text an option so foreign language users can change it
No longer respect the calibre preferences Roman Numerals setting - series index will always be displayed numerically.

Version 1.5.3 - 31 May 2012
Ensure paths to images used by this plugin are stored as relative paths for portability
Change the calibre library image to appear as {Default Image} in the images list
Reorder the images list so {Default Image} and {Current Cover} appear at the top
Allow renaming images changing only their casing

Version 1.5.2 - 20 May 2012
Add a 'Resize cover dimensions to match background image' suboption for if you have stretch image to use as cover background enabled.

Version 1.5.1 - 03 May 2012
Fix issue of version number not incremented for 1.5.0

Version 1.5.0 - 02 May 2012
Fix bug occurring with selection changes and corrupted multiple cover settings
Set maximum font size to 999 instead of 99
Add a separate right margin option, rather than using left margin for both
On the Fonts tab allow specifying the alignment for each text item of left, centre, right rather than always centre
Expose API methods to allow more conveniently calling from other plugins
Add export and import capability for sharing settings/images with other users
Add an 'Autosave setting' option to Settings tab. When checked, any changes to settings are always saved (except when Cancel pressed)
When clicking OK (or Import or Export) prompt user to save settings if changed before continuing.
If font assigned to a setting (whether existing or imported) is not found, use the default font rather than erroring
If user renames image just by stripping extension, treat this same as if user cancelled rename operation
Allow importing of multiple images at once.
Allow importing of multiple setting zips at once.

Version 1.4.0 - 11 Sep 2011
Upgrade to support the centralised keyboard shortcut management in Calibre

Version 1.3.8 - 03 Jul 2011
Replace the deprecated composite_formatter with SafeFormat()

Version 1.3.7 - 04 Jun 2011
Use a progress dialog while generating covers

Version 1.3.6 - 03 Jun 2011
Bug fix for fonts being set to "Default" resulting in null in config file causing an error

Version 1.3.5 - 01 Jun 2011
Add a special token to the list of images representing the current cover for the book to allow embedding
Abort autosize logic with replaced text when text is too large to fit so plugin does not lockup

Version 1.3.4 - 27 Apr 2011
Allow custom text field to be formatted using Calibre template engine
Change custom text field so it is a multiline field for more space and complex content

Version 1.3.3 - 23 Apr 2011
Ensure that margins are set to zero if set to too high a value to prevent crash

Version 1.3.2 - 09 Apr 2011
Support skinning of icons by putting them in a plugin name subfolder of local resources/images

Version 1.3.1 - 04 Apr 2011
Fix error for users migrating from particular previous versions

Version 1.3 - 03 Apr 2011
Rewritten for new plugin infrastructure in Calibre 0.7.53

Version 1.2.1 - 26 Mar 2011
Ensure version number put in config file for first-time user

Version 1.2 - 26 Mar 2011
Support freeform text added to cover.
Add option to autosize text to fit on one line.
Add a timer to ensure GUI does not redraw preview as every UI change made.

Version 1.1 - 16 Mar 2011
Redesign GUI.
Support drag/drop images.
Support text colors.
Support image as background.
Support linking single font.
Support named saved settings.
Copy image files to resources directory.
Support renaming image files.

Version 1.0.2 - 05 Mar 2011
Fix error appearing if trying to customize through preferences

Version 1.0.1 - 05 Mar 2011
Remove fixed widths for users with large fonts

Version 1.0 - 05 Mar 2011
Initial release of Generate Cover plugin

Screenshot_1_Configuration.png Screenshot_2_Configuration.png Screenshot_3_Configuration.png Screenshot_4_Configuration.png 
[zip] Generate (302.4 KB, 7762 views)

#2  msr 03-04-2011, 08:38 PM
Simply great. You're becoming the plugin king!

#3  DoctorOhh 03-05-2011, 02:27 AM
Thanks for this plugin.

The only thing I noticed was not being able to see all 3 numbers in the cover width and height dimensions (see attached).

This might be due to using increased font sizes but this is the only area of calibre that limits me in this way.

#4  kiwidude 03-05-2011, 04:41 AM
Oops, thats a pretty ugly screen layout dwanthy! I've pushed up a new version now. I had been through a lot of variations of layout as this was developed and I thought of new customisations, and I'd left some rather crude sizing code in there. The new version should hopefully address your issues.

Let me know how you get on - now I've figured out what to do I'll make sure I don't make the same mistake in my other plugins again.

#5  DoctorOhh 03-05-2011, 06:06 AM
Quote kiwidude
Let me know how you get on - now I've figured out what to do I'll make sure I don't make the same mistake in my other plugins again.
Looks great!

#6  GRiker 03-05-2011, 10:47 AM
Attempting to customize the plugin yields the following error:

Traceback (most recent call last): File "/Users/griker/Documents/calibredev/calibre/src/calibre/gui2/preferences/", line 260, in customize_plugin self.modify_plugin(op='customize') File "/Users/griker/Documents/calibredev/calibre/src/calibre/gui2/preferences/", line 319, in modify_plugin if not plugin.is_customizable(): File "/Users/griker/Documents/calibredev/calibre/src/calibre/customize/", line 248, in is_customizable self.customization_help() File "<string>", line 59, in customization_help
AttributeError: 'GenerateCoverBase' object has no attribute 'customization_help'
But other than that, this is a very nice plugin.


#7  kiwidude 03-05-2011, 11:09 AM
I've done so many plugins now that have customisation via Preferences I clearly screwed up the situation for a plugin that doesn't and didn't rip out enough code

New version attached to the first post.

#8  Perkin 03-05-2011, 11:11 AM
Thanks kiwidude.

#9  Perkin 03-05-2011, 11:21 AM
A couple of tweaks...
Can you do it so you can select the Font colour
And allow the image to be the whole background, I've got some nice leather look covers and would like the whole cover to be that, not just an inset image.

#10  kiwidude 03-05-2011, 02:54 PM
Quote Perkin
A couple of tweaks...
Can you do it so you can select the Font colour
And allow the image to be the whole background, I've got some nice leather look covers and would like the whole cover to be that, not just an inset image.
Both were on my list to investigate for a future version but I figured I would wait to see if anyone asked for them. Then you ask in the first 24 hours... lol

There is a bit of a dependency between them, since unless you have a light background you are going to want the text color changed. However I haven't figured out how to change the color since I can't find any code in Calibre related to this in the Magick libraries. I suspect it is something to do with a DrawingWand but it is yet another library I have no knowledge of. I'll ask in the developer forum here if Kovid doesn't spot this post and reply here.

  Next »  Last »  (1/75)
Today's Posts | Search this Thread | Login | Register