Categories
Technology

Setting a cover image on an ePub ebook

How to set a cover image on an ePub book.

As some of you may already know, I recently received a Barnes & Noble Nook for Christmas. This has been a great gift and I’m thoroughly enjoying using it to read a lot more literature, but there’s a problem that has been recurring: some publishers don’t properly set the cover art on an e-book, meaning the cover doesn’t show up on my Nook. Since, for me, everything really should be perfect (it’s a disease, trust me), I have been attempting to rectify this problem with my ebooks and I’ve finally come upon the solution. It’s fairly simple to do, as long as you’re a little comfortable with editing in HTML.

The first thing to do if you’re having trouble is to download Calibre and install it. Calibre is a fairly clunky piece of open-source software but it’s very full-featured and allows for ebooks to be edited. Once you’ve installed Calibre, run it and drag the problematic ebook into the library. Now, there are two ways to proceed.

One way (and arguably the easy way) is to click ‘Edit Metadata’, set the correct cover image and then convert the file into an epub; Calibre will embed the correct cover image into the new file. However, this method doesn’t sit well with me and so I’m going to outline how I do it below.

Right-click on the ebook and click ‘Tweak Book’, then click ‘Explode Book’. Look for a file that ends in ‘.opf’ (this will probably be in a folder called OEBPS) and open this file in your favourite text editor.1 There will be, somewhere in this file, a line that says <manifest>. You want to find the ID of the cover within this tag. It’ll probably be something like

<item id="cover_image" href="cover.jpg" media-type="image/jpeg">

and so the ID is cover_image in this case. Now go up to the <metadata> tag and insert a piece of text before the end:

<meta name="cover" content="cover_image"/>

This will let the ePub file know where the cover image is contained, and should therefore show up properly on your Nook. It’s important to note that it has to be in this order: if content comes before name, it will not display correctly. This is because of a bug in the Nook’s implementation of the EPUB specification.


  1. I use TextWrangler on my Macs and Notepad++ on my PCs; your mileage will vary. 

13 replies on “Setting a cover image on an ePub ebook”

It’s worth playing with the input output settings a bit on Calibre. Yes it generates code – but book code is fairly straightforward and the amount of work and updates that goes into calibre is quite staggering – its been a labour of love for Kovid Goyal and his team (and well worth the 30 odd quid I’ve donated over the years to the project). Of course the fact that I can remove the DRM from my Nook books, Adobe Epubs and Kindle books is an added bonus (Note they have to be your books – ie you have to have the registered to you reader and credit cards used available on the pc removing the DRM – this is NOT a way of removing DRM from other peoples books).

I love Calibre. It’s a very useful piece of software for many reasons. However, for this, I have one of three options:

  1. Do it myself, as above.
  2. Let Calibre do it and have the machine code inserted.
  3. Spend ages tweaking the input/output settings so it replicates the effect of option 1 but means I have to invest extra effort.

So, I’ll stick with the first option, ta!

Thanks for this article.

I actually edited the .opf in Sigil, instead of Calibre. Sigil is a better app for editing (and it’s free / open source) but does not have all the file conversion utilities of calibre.

thanks again for this article.

I was never able to convert epub to epub in Calibre to save the cover image without also making other unwanted changes. The method you described works great — it seems that nothing else gets changed doing this. However, I am not able to make this work with svg cover image. The opf file only has one item related to cover: . But inserting that id=”cover” into section doesn’t work. Is it possible that Simple Touch doesn’t support svg format? Or is there something else I need to do?

From that code, the file is trying to set cover.html as the cover. That won’t work because .html files aren’t image files, but I have no idea about svg support generally, so I can’t be more help.

Hi, I tried the code changing and it worked for an online reader, however in Aldiko book reader the cover page was not seen at all. Have you had such problems and could anyone help?