calibre uses the type="cover" entry in <guide> in epub books to know if the first entry in the spine is a cover or not. So if the user specifies their own cover and then re-converts, the original cover is replaced instead of becmoing the second item in the spine

calibre uses the type="cover" entry in <guide> in epub books to know if the first entry in the spine is a cover or not. So if the user specifies their own cover and then re-converts, the original cover is replaced instead of becmoing the second item in the spine

I don't like how you generate the cover, but since this is relatively easy to accommodate I will.

Whether the cover is generated or not is immaterial, the point is that given an epub file, if the user wants software to automatically replace the existing cover the only way the software can know that the file has an existing cover is via the guide.

This is not an issue for an editing software like Sigil, since the user can just manually remove the cover, but it is for an automatic converter like calibre.

This is not an issue for an editing software like Sigil, since the user can just manually remove the cover, but it is for an automatic converter like calibre.

This leads me to my main problem with this idea: I can't force the user to place a chapter break after an image and then somehow semantically mark this chapter/XHTML file as one containing the cover only. How would such a UI option even look like? How would it be presented to the user in a simple and understandable way? And honestly, why should the user care? If I were creating an epub book and would have no intention of messing with it in calibre, I would not do this. It would have no tangible benefit to me.

I also wouldn't want to do this automatically on export, not in an editor. An editor (unlike a converter) should never change the structure of the document the user sees in the editor. WYSIWYG means something very specific.

I would welcome suggestions on how could this be handled, because I can't see how it can be.

Whether the cover is generated or not is immaterial, the point is that given an epub file, if the user wants software to automatically replace the existing cover the only way the software can know that the file has an existing cover is via the guide.

This is not an issue for an editing software like Sigil, since the user can just manually remove the cover, but it is for an automatic converter like calibre.

Wouldn't a first page consisting solely of an image be a reasonably certain indication that it is a cover... regardless of whether the metadata also attests it to be?