View Single Post
Old 10-26-2012, 07:28 PM   #345
Dyspeptica
Member
Dyspeptica began at the beginning.
 
Posts: 20
Karma: 10
Join Date: May 2012
Device: iPad
hfpop:
I fought my way through this, and the answers are that you cannot create the cover you want directly within calibre. You can create the cover outside calibre and then attach it.

I wrote a script to allow for 6 lines for the title, plus series and author. Linux automatically will parse a string variable 'arr="$titlestring"' into an array form, which allows you to call each item of the array: that is, each word of the string using ${arr[@]}. I parsed the array items (arr[0], arr[1] etc for total length, and chopped the array into sections of less than 33 characters each (for font size 34). Each section went into a new line variable (line 1 through 8). So the title was then a stack of 6 line variables, plus the series and author variable lines. The 8 line variables are echo'd to a file. Unused lines are blank, and the series and author follow the title so blanks are at the bottom. The file is all text and looks like this:
"First bit of the title"
"followed by some"
"more until finished"
"Series 1, No. 2"
"Damned Idiot Writer Name"
""
""
""

This is the input, as "titlefilename" to:

convert -background white -font Liberation Serif --pointsize 34 -fill blue -size 800x340 -gravity North label:@titlefilename label1.png

This creates a rectangular form with the proper text. In this case all text formatting is done beforehand, although there are LOTS of eye-candy extras which can be added (shadow, outline, slanted etc).

The label size is determined by the 800x1200 pixel size of the cover and the depth need for 8 lines. The 'fill' item determines the character colors. Allowable html colors are given here: http://www.w3schools.com/html/html_colornames.asp

Then create the actual cover using the background graphic. I sized it to 800x1200. It only has graphical stuff in the bottom 2/3rds leaving lots of room for the label text. The overall background is a very light grey, for visibility.

composite -geometry -10+50 label1.png background.png -blend 90 output1.png

The label is placed 50 pixels down into the background, and moved 10 left to make it center properly (although it is supposed to do that...). In this case the label 'covers' 50 to 390 pixels down into the 'frame'. Note that, except for the text, it is transparent, so the background graphic will show through.

Rename output1.png as desired.

Attach through calibre when creating the epub or use:

ebook-convert oldfile ../epub/newfile --input-profile default --output-profile ipad --input-encoding iso-8859-1 --cover ../cover/output1.png --no-svg-cover --base-font-size 10 --remove-paragraph-spacing --remove-paragraph-spacing-indent-size -1 --unsmarten-punctuation --disable-delete-blank-paragraphs --max-toc-links 0 --no-chapters-in-toc --toc-threshold 0 --author-sort "" --authors "Damned Idiot Writer Name" --publisher "Idiot Press" --title "titlename"

Note that titlename here can be something different (shorter?) than used on the cover. It will appear as the title in calibre's library listings. (So using the Series item might be better.)

It's not actually difficult to do. But the learning *how* to do took a bit of time. If you need help post here. I can provide a stripped down version of my script *for linux* which may not be too useful to you.

Last edited by Dyspeptica; 10-26-2012 at 07:32 PM.
Dyspeptica is offline   Reply With Quote