Jun 26th, 2014, 3:03 pm
Carcosa wrote:Perhaps a more important choice is format - Calibre should always be able to switch formats, but each time you degrade the quality. Even looking back a few years on here and you'll find formats people tend not to release these days, like .lit, and you can see how quickly things can change. Even though recent developments suggest everyone is resigned to the fact that the Nook will never be a true competitor to the Kindle, the .ePub format it uses looks to be here to stay and is a very useful "base" format for converting into others.


While the Nook might be suffering the newer ebooks for modern Kindles (AZW/AZW3/KF8) is basically a zipped file containing a .ePub for the newer ereaders and a .mobi for the older ones. So Amazon has also seen the power of the .epub and is moving over to using it, even if it isn't obvious from the outside. Calibre will convert to AZW3, which will preserve most of the formatting (I'm still experimenting to see what the differences are between that and using Kindle Preview for the conversion). All of which means if you focus on collecting the retail .ePubs (and AZW or AZW3 where available) you should have a pretty future-proofed set of ebooks no matter which ereader you buy over the years. At least until Amazon come up with a way to make their ebooks 3D to work with their new device and then they develop a way to make them holograms that the Kindle Fire 23 will beam directly down your optic nerve into your brain. Even then, I bet Calibre will figure out a way to convert an .ePub into that format ;)
Jun 26th, 2014, 3:03 pm

Links dead? Need re-up? PM me.

Strange is the night where black stars rise,
And strange moons circle through the skies,
But stranger still is Lost Carcosa.
Jun 26th, 2014, 4:45 pm
Carcosa wrote:If you have an AZW/AZW3 to convert there is a Calibre plug-in that unpacks the file, giving you direct access to the .ePub, so Calibre wins there too. I prefer not to convert to .ePub there though if it can't be helped, but I'll store the best quality .ePub and use that as the base format.

I tend to find that the "class=calibre" either comes from people converting older formats (.mobi or .lit) or not knowing how to get at the .ePub in an AZW/AZW3 file (and I'm including myself in that category before I realised what Amazon were doing inside the file). Hopefully, we'll see less of it in the future.

[My emphasis]

Didn't know such a plugin existed. Are you referring to the KindleUnpack plugin listed here? - http://plugins.calibre-ebook.com
Jun 26th, 2014, 4:45 pm
Jun 26th, 2014, 9:36 pm
McJalm wrote:
Carcosa wrote:If you have an AZW/AZW3 to convert there is a Calibre plug-in that unpacks the file, giving you direct access to the .ePub, so Calibre wins there too. I prefer not to convert to .ePub there though if it can't be helped, but I'll store the best quality .ePub and use that as the base format.

I tend to find that the "class=calibre" either comes from people converting older formats (.mobi or .lit) or not knowing how to get at the .ePub in an AZW/AZW3 file (and I'm including myself in that category before I realised what Amazon were doing inside the file). Hopefully, we'll see less of it in the future.

[My emphasis]

Didn't know such a plugin existed. Are you referring to the KindleUnpack plugin listed here? - http://plugins.calibre-ebook.com


That's the one.

If you use it on an AZW/AZW3 file it'll unzip the file into the destination folder. In there are two folders "mobi 7" and "mobi 8". The former contains HTML, OPF and NCX files plus an images folder (like unzipping an epub) and the latter contains an .ePub and OEBPS and META-INF folders (the OEBPS contains all the ePub's text, font, CSS and image files).

Best I can tell from my experiments, is that sometimes on commercial releases, the .ePub is not valid and won't open in Sigil - you'll have to use the HTML file (which is not a pretty sight in the examples I looked at, with the styles embedded in the HTML, presumably as a result of exporting straight from a word processor or InDesign or something - you could easily run some quick find and replaces on it and convert it to CSS with the look intact). However, when I've made my own AZW with a valid working .ePub as the source the the .ePub will open just fine - the coding of the pages and the CSS is exactly the same as it is in the source but Kindle Preview has remade the cover page completely (when I generated the AZW in Kindle Preview it was Sigil's use of SVG which caused a warning and you get another one if the cover is too small - it is converting with an eye on HD readers, so needs a much bigger cover than I'd usually add) and fiddled with the metadata, as well renaming the pages and CSS file (part0001.xhtml and style0001.css). Unless you were comparing the two you'd hardly notice and you could release that ePub as retail quality.

KindleUnpack also has an option in the drop down "KF8 to ePub..." which extracts the ePub and add it to the existing book entry in your Library, so you don't have to go digging through the unpacked folder. I would recommend checking it to make sure it is OK as they can be a bit messy on the code front, but I just checked with another release I got from here and it worked perfectly with no evidence that Calibre has had any contact with the file (which I know can annoy some folks in the ebook community).

So there you have it - that is how you convert an AZW to an .ePub in Calibre. It not only doesn't mess with the book, like a straight conversion would, but it is much quicker.

edit: And if anyone wants to add this:

Preferences >> Get plug-ins to enhance calibre

Scroll down and you'll find it in the right alphabetical order under "not installed" - which should both be the default settings.

You'll want to add it to either the main menu or the context menu (or both) depending on how you like Calibre to look - I did both. If you need to change it, go to:

Preferences >> Change Calibre behavior >> Interface | Toolbars
Jun 26th, 2014, 9:36 pm

Links dead? Need re-up? PM me.

Strange is the night where black stars rise,
And strange moons circle through the skies,
But stranger still is Lost Carcosa.
Jun 26th, 2014, 10:58 pm
What great information! Thank you, carcosa.

Installed the plugin, fiddled with a couple of my existing azw3's, including running the regular Unpack. Then tried the 'KF8 to ePub' function on another one and opened the resulting ePUB in Sigil.

WOW. So nice to see those Calibre classes gone.

Have just applied the KF8 to ePUB function to my remaining azw3's. This is one happy ebooks collector. :D
Jun 26th, 2014, 10:58 pm
Jun 27th, 2014, 4:18 am
McJalm wrote:What great information! Thank you, carcosa.

Installed the plugin, fiddled with a couple of my existing azw3's, including running the regular Unpack. Then tried the 'KF8 to ePub' function on another one and opened the resulting ePUB in Sigil.

WOW. So nice to see those Calibre classes gone.

Have just applied the KF8 to ePUB function to my remaining azw3's. This is one happy ebooks collector. :D


Yeah, I was pretty damn pleased to discover this myself and have been merrily playing with it for the last few days :D

This is clearly one of the must-have for all Calibre users on here, especially if you are going to be releasing books too (I'd also recommend the B&N and Goodreads ID plug-ins, just to give a little more breadth to the outgoing links).

Anyway, you now know, so pass it on when the opportunity arises, as I've just done ;)
Jun 27th, 2014, 4:18 am

Links dead? Need re-up? PM me.

Strange is the night where black stars rise,
And strange moons circle through the skies,
But stranger still is Lost Carcosa.
Jun 30th, 2014, 2:58 pm
Carcosa wrote:if you have an AZW/AZW3 to convert there is a Calibre plug-in that unpacks the file, giving you direct access to the .ePub, so Calibre wins there too.


Actually, I have a simple Python script that unpacks all the mobi variations into the base html and/or the original ePub without the kindle wrapper, so still no need to use Calibre.
Jun 30th, 2014, 2:58 pm
Jun 30th, 2014, 9:42 pm
Steven522 wrote:Actually, I have a simple Python script that unpacks all the mobi variations into the base html and/or the original ePub without the kindle wrapper, so still no need to use Calibre.


Share this please?!
Jun 30th, 2014, 9:42 pm
Jul 1st, 2014, 4:50 pm
littlemew wrote:
Steven522 wrote:Actually, I have a simple Python script that unpacks all the mobi variations into the base html and/or the original ePub without the kindle wrapper, so still no need to use Calibre.


Share this please?!



Here is a ZS link:
KindleUnpack_v067.zip

I hope you are familiar with Python as this requires you to have it installed and working on your computer. After that you just uncompress this to a folder on your drive and double click the KindleUnpack script in the top folder. A simple GUI lets you pick the file to uncompress and the destination folder to store the ePub/html files.
Jul 1st, 2014, 4:50 pm
Jul 11th, 2014, 5:22 pm
Steven522 wrote:
Carcosa wrote:if you have an AZW/AZW3 to convert there is a Calibre plug-in that unpacks the file, giving you direct access to the .ePub, so Calibre wins there too.


Actually, I have a simple Python script that unpacks all the mobi variations into the base html and/or the original ePub without the kindle wrapper, so still no need to use Calibre.


Well yes, quite a few Calibre plugins were floating around as Python scripts before being integrated into Calibre but the good thing about this is that a lot of people have Calibre installed, so using it as a plug-in is pretty straightforward. Being simple and easy to use is important, as a lot of people aren't going to know how to make it work and the more hurdles you put in the way of people using it, the less people are going to bother. I am tech-savvy enough that I reckon I could get this to work, but as a Calibre user I am pleased that I don't have to. :D If it is just a matter of hitting a few buttons in Calibre then there is no excuse for putting an AZW through the grinder of a Calibre conversion, which means we can get better quality ebooks on here

However, thanks for flagging it up for those not using Calibre - the more people that use this the better!!
Jul 11th, 2014, 5:22 pm

Links dead? Need re-up? PM me.

Strange is the night where black stars rise,
And strange moons circle through the skies,
But stranger still is Lost Carcosa.
Jul 11th, 2014, 5:40 pm
Carcosa wrote:Best I can tell from my experiments, is that sometimes on commercial releases, the .ePub is not valid and won't open in Sigil - you'll have to use the HTML file (which is not a pretty sight in the examples I looked at, with the styles embedded in the HTML, presumably as a result of exporting straight from a word processor or InDesign or something - you could easily run some quick find and replaces on it and convert it to CSS with the look intact). However, when I've made my own AZW with a valid working .ePub as the source the the .ePub will open just fine - the coding of the pages and the CSS is exactly the same as it is in the source but Kindle Preview has remade the cover page completely (when I generated the AZW in Kindle Preview it was Sigil's use of SVG which caused a warning and you get another one if the cover is too small - it is converting with an eye on HD readers, so needs a much bigger cover than I'd usually add) and fiddled with the metadata, as well renaming the pages and CSS file (part0001.xhtml and style0001.css). Unless you were comparing the two you'd hardly notice and you could release that ePub as retail quality.


If anyone wants to check this I've now got around to releasing the book I was using as a proof-of-concept for a range of things, including converting an ePub to AZW (the ePub was hand-rolled by me, so I knew it'd be working fine when I fed it into Kindle Preview)


The ePub I used is in there along with the AZW, so you can compare and contrast the input ePub with the output ePub from the unpacked AZW - as I say the changes are no big deal and don't seem to have any impact on the look of the ebook in a reader. What I haven't done is a conversion of the ePub through Calibre so I could check out how it did the conversion as I didn't want to get confused by all the files I'd be juggling before I released the released the book. I will get around to it at some point, but for now that is enough to demonstrate that you can get a usable ePub out of the unpacking as long as you put a usable input into the conversion.
Jul 11th, 2014, 5:40 pm
Jul 11th, 2014, 9:01 pm
And while the importance of this is , as far as I'm concerned, that it allows you to get a good ePub out of an AZW it also means that someone with an older Kindle (Kindle 2/DX and below, from what I've read) can also extract a usable retail quality MOBI from the AZW. So everyone wins :D Of course, it does require people to know about the nature of the file format and the fact that you can unpack it, something you can't rely on (see this discussion). All we can do is spread the word.
Jul 11th, 2014, 9:01 pm

Links dead? Need re-up? PM me.

Strange is the night where black stars rise,
And strange moons circle through the skies,
But stranger still is Lost Carcosa.
Jan 13th, 2020, 7:51 pm
Oh man, I wish I knew of KindleUnpack years ago. Comparing a converted and extracted .epub page by page, the biggest difference I find is with the images files. They are resaved with some loss in image quality. Not a huge difference but noticeable.
Jan 13th, 2020, 7:51 pm
Apr 29th, 2020, 10:50 pm
Partial cross-post from my answer to another question:

"Then I extracted it as an epub and discovered something else unrelated to your question. The extracted epub was hugely bloated! Again, I opened it for editing and found that all the stuff left over in the target directory was added to the new epub. Images, text, URLs, etc.. It shocked and embarrassed me because I've used this process before as a courtesy and now I wonder how crap my results really were!

Lesson: delete all files in the target directory after each extraction."

Later: Turns out the actual epub is just fine to read. It's just bloated because of the non-usable pointers/references. Still, delete those files from the target directory.
Apr 29th, 2020, 10:50 pm


Use this. It's free. https://www.libraryextension.com/
A link to my family's fiction wishlist is posted in my profile.
Rules apply.
WRZ$20 each.
No PDFs, PDF conversions or archive.org scans (I can get those myself).