Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 08-14-2011, 09:26 PM   #1
steje
Member
steje began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2011
Device: kindle, ipad
Managing cover images in mobi/epub files

First time Calibre user here... and trying to understand if Calibre is able to truly remove cover images embedded into various mobi files I have or not.

After adding some mobi files into Calibre, and then editing metadata, none of the changes are written out to the file that I actually added to Calibre, but are instead (I presume) saved in some kind of Calibre library database or index or something? The only way I see to write the changes out to file is by using the "Save to disk" feature... which appears to write the file out to a new file...

While title and author changes appear to be written out to the new file... the 'original' cover image(s) are still all present and not actually removed. Any 'new' cover image I add in Calibre is saved to a JPG file, and not embedded in the mobi file.

I want to achieve TWO things:

1.) Make sure any and all 'existing' cover images embedded in the mobi file are stripped out...
2.) Make sure any 'new' cover image I add in Calibre gets embedded in the file I Save to disk...

I will also be 'converting' some of the MOBI files and saving them as EPUB along with newly modified MOBI, as I want to put the same books on my wifes iPad as well as my kindle... and while I am not familiar with EPUB format conventions - I'm assuming it's valid to want the cover image embedded into resulting EPUB file that I want to save off to disk as well...

Can someone offer guidance...?
steje is offline   Reply With Quote
Old 08-14-2011, 09:54 PM   #2
dwig
Guru
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 969
Karma: 1382338
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Dell Venue 8 Pro, Kindle 3/WiFi - Retired:Clie UX50, T415, ...
The cover image in both MOBI and EPUB resides in the core portion of the file. It is not "metadata", and therefore can't be changed without rebuilding the file.

To change the cover in a MOBI you must convert it, generating a completely new file. With calibre you can do a MOBI to MOBI conversion to accomplish this.

EPUB files are actually just specially organized ZIP archives. You can change the cover image by converting in calibre (either MOBI > EPUB or EPUB > EPUB). You can also change the image by opening the archive (using calibre's Tweak EPUB function or by changing its extension to ZIP and viewing the contents).

If you do the latter, you need to replace the existing cover image(s) with new images of matching size(s) in the archive. Do not extract the archive components and then attempt to rebuild an archive. Rebuilding the archive from scratch is somewhat tricky.
dwig is offline   Reply With Quote
Old 08-14-2011, 10:33 PM   #3
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,838
Karma: 12535517
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by steje View Post
I want to achieve TWO things:

1.) Make sure any and all 'existing' cover images embedded in the mobi file are stripped out...
2.) Make sure any 'new' cover image I add in Calibre gets embedded in the file I Save to disk...

I will also be 'converting' some of the MOBI files and saving them as EPUB along with newly modified MOBI, as I want to put the same books on my wifes iPad as well as my kindle... and while I am not familiar with EPUB format conventions - I'm assuming it's valid to want the cover image embedded into resulting EPUB file that I want to save off to disk as well...
I don't use mobi but I think the only way to ensure the cover is embedded in the book is to do a mobi to mobi conversion.

When you convert the mobi to epub the new cover will be embedded in the epub. Also if you have epubs from some other source you can embed the cover using the modify epub plugin (beta).

Good Luck.
DoctorOhh is offline   Reply With Quote
Old 08-15-2011, 12:02 AM   #4
steje
Member
steje began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2011
Device: kindle, ipad
Thanks to both of you... the mobi to mobi conversion seems to do the trick. And the info about the epub format is good to know, I will mainly be converting from mobi to epub (for "now") and will have gotten the cover image sorted out before conversion. Thanks again... would never have suspected mobi to mobi conversion as being necessary.
steje is offline   Reply With Quote
Old 08-15-2011, 12:59 PM   #5
steje
Member
steje began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2011
Device: kindle, ipad
Actually, I was mistaken... converting from mobi to mobi does NOT remove existing cover images (for instance, if you REMOVE the existing cover image in calibre, then convert mobi-to-mobi)... the images remain.

What DOES work, is if you assign a NEW cover image, then convert mobi-to-mobi, then the 'new' image is properly set as the cover image (properly adjusted offsets or whatever) but all of the existing images remain as well.

This is all kind of counter-intuitive. I'd expect that if I assign a new cover, and then save to disk, that calibre should do whatever is needed (convert mobi to mobi acrobatics) in order for that cover to actually be saved in the file so that it is visible when I copy that file to a device...

The only way I have found to properly "clean out" these unwanted images... is to convert the original mobi to OEB folder/HTML, then add the resulting HTML file back to calibre, redo all the metadata tags, convert HTML/ZIP back to MOBI, and then I have a pretty "clean" mobi file with JUST the cover image I've specified in calibre.

Gotta say that's a rather disappointing series of hoops to have to jump through to do something I'd have thought is a mundane action on an ebook (stripping unwanted cover images and replacing with a desired cover image).

If there's an easier way... that would be real nice. I'm already converting original mobi to OEB folder/HTML from the command line tool, maybe some older VB scripts I wrote to use the mobiperl tools can be modified to do all the rest of the work I'm struggling with using the calibre cli instead of the gui.
steje is offline   Reply With Quote
Old 08-15-2011, 06:27 PM   #6
dwig
Guru
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 969
Karma: 1382338
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Dell Venue 8 Pro, Kindle 3/WiFi - Retired:Clie UX50, T415, ...
Quote:
Originally Posted by steje View Post
...

The only way I have found to properly "clean out" these unwanted images... is to convert the original mobi to OEB folder/HTML, then add the resulting HTML file back to calibre, redo all the metadata tags, convert HTML/ZIP back to MOBI, and then I have a pretty "clean" mobi file with JUST the cover image I've specified in calibre...
One the occasions that I need to significantly massage a MOBI file I've found that a calibre MOBI>EPUB conversion, an edit in Sigil, and then EPUB>MOBI in calibre is the easiest workflow. Using Sigil avoids the issues of the loss of metadata, allows for proper TOC management, makes setting chapter breaks easy (caution with the new v0.4.0!!, I use 0.3.4), and allows decent image control.
dwig is offline   Reply With Quote
Old 08-15-2011, 07:21 PM   #7
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,838
Karma: 12535517
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by steje View Post
This is all kind of counter-intuitive. I'd expect that if I assign a new cover, and then save to disk, that calibre should do whatever is needed (convert mobi to mobi acrobatics) in order for that cover to actually be saved in the file so that it is visible when I copy that file to a device...
This seems to be caused by mobi's archaic standards. The cover is not easily identified from the basic html code. If you were dealing with epub the cover is easier to identify and often will be updated during save to disk or send to device and as dwig has stated Sigil is a very easy tool for basic changes to any epub book.

Have you tried checking "Remove first image" under Preferences - Common Options - structure detection? This will remove the first image in a book during conversion, usually the cover.

That's the extent of my vast knowledge.

Good Luck.
DoctorOhh is offline   Reply With Quote
Old 08-19-2011, 09:28 AM   #8
steje
Member
steje began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2011
Device: kindle, ipad
@dwanthny: well, I can't attest to the archaic-ness of mobi's standard :-)... though if you can store an image and then display it - it would seem to me to operate based on rules that should allow the same to be removed and any offsets adjusted. My understanding is that the "cover" image can be stuck into a mobi file in one of several ways - one where it is identified in some header data as "the" cover image, with associated offsets, etc... vs the other way (which I think you alluded to) being just "an" image like any other referenced in the actual HTML of the book content - like any other chapter header images and other in-story images.

re: that last - I dabbled with the "Remove first image" option you mentioned, but it appears I have some mobi files that have the cover image listed OTHER than as the first image, etc... Sigh.

At this point - from a workflow perspective, the most consistently useful method for me is to just convert to html, clean out any references to any existing cover image, then re-convert to mobi (and epub as well for that matter). Since I "am" converting to epub now as well - I'll see if converting straight to epub first instead of html, then making my mods in sigil, then final convert from epub to mobi works ok (ta dwig)...

Thanks all for the thoughts and information - you guys are quite responsive and welcoming to newcomers. Much appreciated!
steje is offline   Reply With Quote
Old 08-19-2011, 06:44 PM   #9
dwig
Guru
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 969
Karma: 1382338
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Dell Venue 8 Pro, Kindle 3/WiFi - Retired:Clie UX50, T415, ...
Quote:
Originally Posted by steje View Post
...
re: that last - I dabbled with the "Remove first image" option you mentioned, but it appears I have some mobi files that have the cover image listed OTHER than as the first image, etc... Sigh.
...
MOBI cover images are not placed in the body of the ebook. It is common, though, for an EPUB to have both a true cover image and a second copy placed at the beginning of the book data.

When these EPUBs get converted to MOBI the resulting file has a true MOBI-style cover and a matching image at the beginning of the book itself. Often this second image displays at a different size on a Kindle as the Kindle zooms the true cover to fit the screen and the second copy is treated like any other image in the book and displayed at its native size or that spec'd in the <img> tag. Calibre's "remove first image" can remove the extra copy from the book data but does not touch the true cover image.
dwig is offline   Reply With Quote
Old 08-20-2011, 04:41 AM   #10
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 63,368
Karma: 41542799
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Onyx T68, N7,
Quote:
Originally Posted by dwanthny View Post
This seems to be caused by mobi's archaic standards. The cover is not easily identified from the basic html code.
I must respectfully disagree. The cover, in a Mobi book, is not in the HTML at all; it's identified (and very clearly identified) in the OPF file. There's nothing "archaic" about it .
HarryT is online now   Reply With Quote
Old 08-20-2011, 05:43 AM   #11
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,838
Karma: 12535517
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by HarryT View Post
I must respectfully disagree. The cover, in a Mobi book, is not in the HTML at all; it's identified (and very clearly identified) in the OPF file. There's nothing "archaic" about it .
I defer to your obvious experience with the mobi format.

Thanks for the info.

Last edited by DoctorOhh; 08-20-2011 at 11:51 PM.
DoctorOhh is offline   Reply With Quote
Old 08-20-2011, 11:50 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: 25,908
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by HarryT View Post
I must respectfully disagree. The cover, in a Mobi book, is not in the HTML at all; it's identified (and very clearly identified) in the OPF file. There's nothing "archaic" about it .
In an actual MOBI file the cover is stored in an arbitrary Palm DB record. Properly created MOBI files have a field correctly set in their headers that gives the record number of this record, but just as with epub, there are tons of MOBI files out there that do not have this field in the header set.
kovidgoyal is offline   Reply With Quote
Old 08-20-2011, 11:52 AM   #13
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 63,368
Karma: 41542799
Join Date: Nov 2006
Location: UK
Device: PW2, iPad Retina Mini, iPhone 4, MS Surface Pro, Onyx T68, N7,
Quote:
Originally Posted by kovidgoyal View Post
In an actual MOBI file the cover is stored in an arbitrary Palm DB record. Properly created MOBI files have a field correctly set in their headers that gives the record number of this record, but just as with epub, there are tons of MOBI files out there that do not have this field in the header set.
Thank you for the clarification, Kovid. I always think in terms of the source files used to create a Mobi book.
HarryT is online now   Reply With Quote
Old 08-26-2011, 03:59 PM   #14
steje
Member
steje began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2011
Device: kindle, ipad
Quote:
Originally Posted by kovidgoyal View Post
...there are tons of MOBI files out there that do not have this field in the header set.
In such a case, would Calibre even be displaying a cover image in the edit metadata view though...?

In any case, I would have expected that if Calibre can identify and display a cover image in an existing MOBI file, that "removing" that cover image, then saving to disk should result in a mobi file that no longer contains that image. period... Perhaps it was doing so, but the resulting re-saved or converted MOBI file that I then looked at still had the 'other' image embedded in the HTML without having used that "Remove first image" option. Not sure - I'd have to go back and compare my starting MOBI vs a re-saved and converted mobi with and without that option set.

While it's time consuming, I'm content for now with converting to html, cleaning out any unwanted images (sometimes that's more than just a very bad cover image... but sometimes other ugly images included in the html, which I remove references to), then reconvert to both MOBI and EPUB after I've found better looking covert art.
steje is offline   Reply With Quote
Old 08-26-2011, 04:27 PM   #15
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: 25,908
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Because in that case calibre assumes the first image is the cover, a safe assumption since even if calibre is wrong, there is no great harm done. Which is obviously not the case when replacing an image.
kovidgoyal is offline   Reply With Quote
Reply

Tags
cover, epub, image, metadata, mobi

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobi files - images DWC Introduce Yourself 5 07-06-2011 01:43 AM
epub to mobi error when including images HarrisS Conversion 1 02-08-2011 08:57 AM
help mobi to epub conversion: lost all images Sylver Calibre 10 01-13-2011 08:31 PM
How to increase teh size of images in .mobi files nvr Kindle Formats 2 01-12-2010 11:23 AM
trouble with ePub cover images bossmanx9 Calibre 10 04-28-2009 06:16 PM


All times are GMT -4. The time now is 05:39 AM.


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