View Single Post
Old 04-24-2015, 08:14 PM   #1
johnb0647
Nameless Being
 
Batch remove multiple covers?

CALIBRE v2.23
LINUX MINT (CINNAMON) 17.1

I've been collecting ebooks since the "Neuvomedia Rocket" (1998) so I've had to convert format's a number of times which may have contributed to this issue.

Now my "standard" is epub.

I've noticed that I have hundreds of titles that Calibre doe not recognize as having a cover <therefore showing the generic cover> BUT when I open the book there IS a cover image..... in many cases two or more copies of the same image. NOTE: re-checking a representative original MOBI format shows the images already there so they apparently did not appear as an artefact of the CALIBRE MOBI > EPUB conversion.

Opening a representative title with "edit ebook" shows:

1. titlepage.xhtml
2. index_split_000.html
3. index_split_001.html
... <more sections containing text>

Where these first three "sections" contain the same image (with different coding including references to Calibre), yet Calibre shows a generic cover.

SEE BELOW FOR EXAMPLE OF HTML CODING.

In some cases the total (storage) size (in mb) of the covers exceeds the size of the text portion of the document.

I can manually eliminate this by:
A. Open the epub as a zip, extract a copy of the cover and del the image files.
B. In Calibre, "edit ebook" and delete all the "sections" containing cover image references.
C. In Calibre, "edit metadata" and add the extracted cover.
D. In Calibre, "convert" epub to epub (eliminates references to absent images)

This is not practical for hundreds of ebooks.

Any suggestions for an automated way to do this?

NOTE: I have no evidence this is a "bug" in Calibre since the multiple images were present in the original files before conversion (mobi to epub). It's possible the appeared in earlier conversions but since I cannot examine the code I can't verify it.

For now I'm interested in a fix.

EXAMPLE:

titlepage.xhtml

<?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: 0pt; margin:0pt}
body { text-align: center; padding:0pt; margin: 0pt }
div { padding:0pt; margin: 0pt }
img { padding:0pt; margin: 0pt }
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<div>
<img src="images/calibre_cover.jpg" alt="cover" style="height: 100%"/>
</div>
</body>
</html>

index_split_000.html

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Die Trying - Reacher 02</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>
<body class="calibre">
<div class="calibre1">
<p class="calibre_"><img src="images/00002.jpg" class="calibre_1"/></p>
<div class="calibre1"></div>
<div class="mbp_pagebreak" id="calibre_pb_0"></div>
</div>
</body></html>

index_split_001.html

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Die Trying - Reacher 02</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>
<body class="calibre">
<div class="calibre1">
</div>
<div class="calibre1">
<p class="whitespace"> </p>
<a></a>
<p class="whitespace"> </p>
<a></a>
<p class="calibre_"><img src="images/00001.jpg" class="calibre_2"/></p>
<div class="calibre1"></div>
<div class="mbp_pagebreak" id="calibre_pb_1"></div>
</div>
</body></html>

Last edited by johnb0647; 04-24-2015 at 08:17 PM.
  Reply With Quote