Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-23-2017, 02:43 PM   #1
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Question About Adding Image Covers vs Conversion Only

When I add a book cover to a file and then convert, the result is different HTML codes than when I just convert a file. Is there any way I can have this be consistent and get the same HTML codes I get when adding a book cover and converting? I prefer the way the cover images look with the code listed below.

Example of the code I'd like to get when I just convert files, so I don't have to edit manually every converted file in which I didn't add a cover image:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
<style type="text/css" title="override_css">
@page {
padding: 0;
margin: 0;
}
body {
text-align: center;
padding: 0;
margin: 0;
}
div {
padding: 0;
margin: 0;
}
img {
padding: 0;
margin: 0;
}
</style>
</head>

<body>

<div>

<img src="cover.jpeg" alt="cover" style="height: 100%"/>

</div>


Thanks for any help with this!

Last edited by deback; 10-23-2017 at 03:04 PM.
deback is offline   Reply With Quote
Old 10-23-2017, 03:55 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,897
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by deback View Post
When I add a book cover to a file and then convert, the result is different HTML codes than when I just convert a file. Is there any way I can have this be consistent and get the same HTML codes I get when adding a book cover and converting? I prefer the way the cover images look with the code listed below.

Example of the code I'd like to get when I just convert files, so I don't have to edit manually every converted file in which I didn't add a cover image:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
<style type="text/css" title="override_css">
@page {
padding: 0;
margin: 0;
}
body {
text-align: center;
padding: 0;
margin: 0;
}
div {
padding: 0;
margin: 0;
}
img {
padding: 0;
margin: 0;
}
</style>
</head>

<body>

<div>

<img src="cover.jpeg" alt="cover" style="height: 100%"/>

</div>


Thanks for any help with this!
Why not just use 'Polish' or Modify EPUB plugin to Update the book.
Those 2 do not convert, they simply use the cover and metadata from the Library manager.
theducks is online now   Reply With Quote
Advert
Old 10-23-2017, 04:34 PM   #3
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Quote:
Originally Posted by theducks View Post
Why not just use 'Polish' or Modify EPUB plugin to Update the book.
Those 2 do not convert, they simply use the cover and metadata from the Library manager.
Why not? Because I'm fussy (perfectionist) and have lots of things to edit in each epub file. I don't believe those two things would do all the things I do when I edit a file. I'm just trying to limit the amount of things I do every time I open an epub file.

I don't use the Library. I only use Calibre to convert files, add or replace cover images, and to edit them in Edit Book.

I drag epub files into Calibre and then use Convert to either add covers and convert or just convert--and then I use Edit Book to manually edit each of the epub files to fix the stuff that the conversion process doesn't fix (delete extra cover images, copy and paste the cover image code I like the best, change the CSS codes to remove linespaces in only the text portion, find and fix all errors with Check Book, remove unused CSS rules, beautify files, and some other fixes)--and then I drag the epub files back to the author folder in File Explorer where I store all the epub files. I don't keep the individual metadata and cover files...

I was just wondering why there are different HTML codes when you add a cover image and convert vs. when you just convert a file that already has an image. The cover image appearance is different in both cases. I would like to see the conversion process (when you don't add a cover image) use the code that I get when I add a cover image and convert.

It would be so great if the conversion process would do all these things that I do manually, but I don't expect that will happen. I am thankful that I can smarten the punctuation, set the margins, justify the text, and add a font. I would love to find out that I'm missing some settings somewhere that would do some of these things I do manually.

Thanks.

Last edited by deback; 10-23-2017 at 04:49 PM.
deback is offline   Reply With Quote
Old 10-23-2017, 05:44 PM   #4
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
I checked out Polish Book and Modify EPUB. Looks like I can use them both to do a couple of the things I do with every EPUB file. I'll still have to manually edit each book to fix the cover image coding, delete the linespaces in the text portion, run Check Book and fix any errors found by Calibre, and to do a couple other things I check or do.

But neither of those will fix the cover image to be like what I want. They also won't do a bulk rename of the chapters in the TOC, and they won't edit the CSS rules for the chapter opening paragraph and the rest of the paragraphs to have zero margins and 1.3em for the text indent. And they won't Check the book and fix all the various errors or beautify the files (which fixes errors, too). So, I will have to keep manually editing each file.

Thanks for your help, theducks! (I can use your suggestions to delete unused images, remove unused CSS rules, and delete the xpgt files.)

Last edited by deback; 10-23-2017 at 06:48 PM.
deback is offline   Reply With Quote
Old 10-23-2017, 09:45 PM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I think the answer is you are going to have to continue to do this manually unless you write a plugin to do it. All the automatic methods I can think of will put the cover into the book in an SVG wrapper. And the reason they do that is they are all calling the same calibre code to do it. If you are willing to run calibre from source code, it is possible to make changes that would produce what you want.

But, I'm curious about why you don't want the SVG wrapper for the cover image. As far as I can tell, that is the best way to display the image. When people ask the question about how to add cover in the Workshop forum, code similar to what calibre uses is suggested. The suggestion isn't coming just from calibre users, but professional ebook creators as well.
davidfor is offline   Reply With Quote
Advert
Old 10-24-2017, 07:59 AM   #6
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
I just did some experimenting with different common options settings for the cover image. When the SVG Cover is checked or unchecked and the Preserve Cover Ratio is checked or unchecked, there is no difference, and the image does not get centered and doesn't move when ADE is dragged on the side. There is blank space at the top and bottom, and the left and right margins are not centered. These are the reasons why I don't want to use an SVG wrapper. The cover image displays the best in ADE when I have "No SVG Cover" checked in the options.

When I use the code I pasted in my first message in this thread (which Calibre generates when you add a new cover image--so why doesn't Calibre generate it when I just convert and don't add a cover image?), the image is perfectly centered with white space on the side margins and the image moves when ADE is dragged on one side. I prefer the way this looks the best, but I have to manually copy and paste that code over the "SVG" code that doesn't even have a "text-align: center" code in the CSS rule for the cover image.

I won't be programming any plugin, since I'm not a programmer (except for some Applesoft programming decades ago, writing batch files, and basic HTML). But I do like the Modify EPUB plugin. This will save me lots of time in the future. Thank you for your help with this.

Last edited by deback; 10-24-2017 at 11:03 AM.
deback is offline   Reply With Quote
Old 10-24-2017, 04:55 PM   #7
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Here's something else I just discovered: When the cover image file is not marked as the cover image file, then the Calibre conversion will use the code I pasted in my first post for the first image, and then it will create a duplicate of the same cover image and place it as the second file in the list of html files.

So, this is another reason why I'm having to manually edit so many ebooks (that were created by so-called professional ebook creators), in addition to many other things they screw up when they create their ebooks. I've manually edited hundreds or probably well over a thousand epub files so far in the last two+ years (not counting the conversions and adding covers), and sometimes, I just can't believe the mess I find when I open an epub file that's supposed to be a retail version.

I would like to see the Calibre conversion remove xpgt files and the related codes. If there's a current way to do that (using Calibre Convert), I'd appreciate knowing about it. That seems to be the only reason why I'll use the Modify EPUB plugin, since the Calibre Convert does the other choices I might check in Modify EPUB.
deback is offline   Reply With Quote
Old 10-24-2017, 08:39 PM   #8
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Here's another thing my experimenting has discovered. I just converted an epub file and had the conversion remove the "font-family" CSS rules and add the Charis font. It deleted the CSS codes for font-family, but left the font files in the file. It also changed the cover image, which resulted in being uncentered, when it was originally centered. Here is the CSS code for the class that is above the "<img...>:

.calibre11 {
display: block;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
}

There is no line for: text-align: center;

Here is the HTML code for the cover image after the conversion for an image that was already in the file:

<div class="calibre11">

<img src="cover.jpeg" alt="cover" class="calibre12"/>

</div>

Is this something that should be fixed in Calibre?

Also, could two new features be added to allow us to remove the actual font files and the xpgt files when converting? I know I could use Modify EPUB to do those two things, but since Calibre Convert does almost everything else...

It would be great if the cover image thing could be fixed and the two options to delete the font and xpgt files could be added.

Last edited by deback; 10-24-2017 at 08:48 PM.
deback is offline   Reply With Quote
Old 10-24-2017, 08:41 PM   #9
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
I think the messing up of the cover images when converting is what's driving me nuts...
deback is offline   Reply With Quote
Old 10-24-2017, 09:49 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,897
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Both the HTML file and the image MUST be marked as cover
Calibre conversion will replace a cover (when it is properly marked)
It will ADD a new cover if any of the marks are missing.

Covers (SVG wrapped) just work for so many users, that you must be fighting Calibre to get it a little more 'your way'.
Maintaining Aspect is 900% more important to me, than filling every inch of the screen.

I bought Laser Discs in the 80's because I could see movies in widescreen. So what, if there were black bars top and bottom.
theducks is online now   Reply With Quote
Old 10-24-2017, 11:35 PM   #11
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Quote:
Originally Posted by theducks View Post
Both the HTML file and the image MUST be marked as cover
Calibre conversion will replace a cover (when it is properly marked)
It will ADD a new cover if any of the marks are missing.

Covers (SVG wrapped) just work for so many users, that you must be fighting Calibre to get it a little more 'your way'.
Maintaining Aspect is 900% more important to me, than filling every inch of the screen.

I bought Laser Discs in the 80's because I could see movies in widescreen. So what, if there were black bars top and bottom.
Well, Calibre creates the code that I like the best (I didn't just come up with that code...I got it from the HTML in the titlepage.xhtml file after adding images and converting), so I'm still wondering why the conversion process isn't consistent and creates a different set of code when just converting vs. the code it creates when adding an image and converting. I'm not fighting anything; just trying to find out why Calibre uses two (or more) different cover codes and why one of them doesn't center the image. I guess I'm looking for a setting that will let me choose which HTML code I prefer for the cover image, instead of getting whatever HTML code Calibre decides to use when I convert (which I realize is probably dependent on the existing code in the file before the conversion).

I'm not trying to fill every inch of the screen. That's why I like the code I posted the best--there is white space on both sides, the aspect is maintained, and it's perfectly centered with no white space at the top or bottom. I also prefer to maintain the aspect, but I also would like the image centered and Calibre does not always center it.

And what you said in your first paragraph is what I meant. I was just saying that I finally realized why sometimes Calibre Convert creates a duplicate image. I've never taken the time to experiment very much with some of the conversion options until recently, because I was spending most of my time learning CSS, how to format an ebook, learning all the editor functions, and editing scanned ebooks (or just adding cover images) before I progressed into my current stage of working with ebooks.

Last edited by deback; 10-24-2017 at 11:38 PM.
deback is offline   Reply With Quote
Old 10-25-2017, 12:30 AM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,942
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
svg cover images are always centered and can preserve aspect ratio or not as per your preferences. And when conversion inserts a cover it always uses SVG, unless you set the option to not use SVG.

As for the rest of your questions, trying to guess what you are actually doing from your descriptions of what you think you are doing is too difficult, see https://www.mobileread.com/forums/sh...d.php?t=186697
kovidgoyal is offline   Reply With Quote
Old 10-25-2017, 08:53 AM   #13
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Quote:
Originally Posted by kovidgoyal View Post
svg cover images are always centered and can preserve aspect ratio or not as per your preferences. And when conversion inserts a cover it always uses SVG, unless you set the option to not use SVG.

As for the rest of your questions, trying to guess what you are actually doing from your descriptions of what you think you are doing is too difficult, see https://www.mobileread.com/forums/sh...d.php?t=186697
Thank you for your response. I'm sorry my posts are not understandable. I realize that I post long messages, and that's because I try to give enough details, but then I know that long messages are a pain to have to read through.

I just did an experiment: Converted a file that did not have the cover image PNG file marked as the cover and the XHTML file was not marked as the cover (a common problem with ebooks...). The conversion (with No SVG checked) did not center the cover image and there was a duplicate cover page created (as expected). Then I marked both files as the cover image, unchecked No SVG, checked Preserve ratio, did the conversion again, and the image was centered with no duplicate image HTML file created.

So, it seems I now have the right settings, but I will have to manually make sure that both files are marked as the cover image (which I knew about, but I was trying to avoid having to do that due to the quantity of ebooks I'm working with--and many of the epub files don't have those two files marked as the cover image).

Thank you all for your help!
deback is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Covers When Adding Books windom Library Management 4 08-16-2011 04:36 PM
Adding covers reemas Devices 1 04-27-2011 08:05 PM
Adding covers Sweetpea Calibre 5 12-01-2010 11:41 AM
Adding Pictures As Covers dkritso109 Calibre 8 10-24-2010 12:13 PM


All times are GMT -4. The time now is 12:11 PM.


MobileRead.com is a privately owned, operated and funded community.