Answers.Body: <p>Images in general should be added just as they would be in HTML, with an <code>&lt;img&gt;</code> tag. The image files themselves should then be included in the OEBPS folder or a subfolder (I generally use a subfolder, personally). Each image file will need to be declared in the <code>&lt;manifest&gt;</code> section of the content.opf file. As mentioned in the <a href="http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-item-property-values" rel="noreferrer">epub 3.0 specifications</a>, the cover image in particular should also have the <code>cover-image</code> property assigned to it in the <code>&lt;manifest&gt;</code>, like so:</p>
  
  <pre><code>&lt;item id="cover_jpg" properties="cover-image" href="images/cover.jpg" media-type="image/jpeg" /&gt;
  </code></pre>
  
  <p>The <code>&lt;manifest&gt;</code> entry for non-cover images is the same, just without the <code>properties="cover-image"</code> bit.</p>
  
  <p>That's it for plain epub, but some retailers will also ask for a <code>&lt;meta&gt;</code> element in the <code>&lt;metadata&gt;</code> section of the content.opf file declaring the cover, like so (from Amazon's <a href="http://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf%E2%80%8E" rel="noreferrer">Kindle Publishing Guidelines</a>):</p>
  
  <pre><code>&lt;meta name="cover" content="images/cover.jpg" /&gt;
  </code></pre>
  
  <p>Note that Amazon in particular no longer requires the <code>&lt;meta&gt;</code> bit as long as the <code>properties="cover-image"</code> is correctly declared.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-03-28T18:32:24.943Z
Answers.LastActivityDate: 2014-03-29T01:00:29.643Z
Answers.LastEditDate: 2014-03-29T01:00:29.643Z
Answers.UserDisplayName: Tom
Answers.Body: <p>I suggest you use Sigil, or another ebook creator software.</p>
  
  <p>Don't start from scratch with an .html file, it's more complicated, start from scratch with a sofware. I can list the things that you can have with that kind of sofwares that you'll have automatically, and that you couldn't have with a non specialised software.</p>
  
  <p>And be careful if you use a word processor, or an on specialised software, they include a lot of code that is not compatible with the ebook formats. You have to fix everything by reviewing all the code by yourself, so they are not recommendable to do that.</p>
  
  <ul>
  <li><p>First, it's good practice that you insert the cover as the first .xhtml page in your ebook.</p></li>
  <li><p>A good book cover should:</p></li>
  <li><p>Allow to read clearly, even when the image is small.  </p></li>
  <li>Have a good look in a black and white reader.</li>
  <li>Have a good size.</li>
  </ul>
  
  <p>Amazon, for instance, says: </p>
  
  <blockquote>
    <p>Your cover image must be less than 50MB. Try to avoid compressing your
    files. This can affect the quality of your cover when displayed on
    reading devices. For the best results, images should have a minimum
    resolution of 300 PPI (pixels per inch).</p>
  </blockquote>
  
  <p>And:</p>
  
  <blockquote>
    <p>The ideal size of your eBook cover art is a height/width ratio of
    1.6:1. This means that for every 1,000 pixels in width, the image should be 1,600 pixels in height. To ensure the best quality for your
    image, particularly on high definition devices, the height of the
    image should be at least 2,500 pixels. Ideal dimensions for cover
    files are 2,560 x 1,600 pixels.</p>
    
    <p>Note: The minimum image size allowed is 1,000 x 625 pixels. The
    maximum image size allowed is 10,000 x 10,000 pixels.</p>
  </blockquote>
  
  <p>-</p>
  
  <ul>
  <li>Sigil for instance automatically include the cover image in a  wrapper.</li>
  </ul>
  
  <p>The advantage, is that .SVG files have a little size, and resize very well, without losing clarity. The goal is to have the cover automatically resizing according to the reader screen, that can be very different from one reader to another.</p>
  
  <p>The disavantage is that some readers doesn't support SVG (you have to check if it's the case for the reader you target, I don't know which ones, the link I mentioned tells us that they do exist.). Each time it's possible, if it's supported, use rather SVG and nothing else.</p>
  
  <ul>
  <li><p>Create a CSS sheet for the cover. Call it cover.css, not mandatory, but clearer and easier to manage.</p></li>
  <li><p>So insert an image in your ebook file with the software, click add a cover, choose the image as a cover (you can also right-click on the image, go in the semantic menu, and choose the cover as the semantic, those 2 ways can turn an image into a cover)</p></li>
  <li><p>Name the .xhtml generated by your software as cover.xhtml. 
  Then link the cover.css with the cover.xhtml.</p></li>
  </ul>
  
  <p>It's automatically made in the software by right-clicking on the .xhtml file and associate the .xhtml to a CSS, and you choose the name of the CSS file.</p>
  
  <p>To make it manually, in the head section of you .xtml file:</p>
  
  <pre><code>&lt;link href="../Styles/cover.css" type="text/css" rel="stylesheet"/&gt;
  </code></pre>
  
  <ul>
  <li>This is the .xhtml code generated by Sigil for the cover of my book, this is the code for the whole page:</li>
  </ul>
  
  <p><code><pre>
      
      </p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
    &lt;title&gt;Cover&lt;/title&gt;
  &lt;link href="../Styles/cover.css" type="text/css" rel="stylesheet"/&gt;
  &lt;/head&gt;
  
  &lt;body class="fullpage"&gt;
    &lt;div class="cover" id="cover"&gt;
      &lt;svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 1410 2250" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
        &lt;image id="coverimage" alt="cover image" width="1410" height="2250" xlink:href="../Images/cover.png"/&gt;
      &lt;/svg&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p></code></pre></p>
  
  <p>My CSS code in cover.css:</p>
  
  <pre><code>   .cover{
      background-color: grey;
      text-align: center;
      padding: 0pt;
      margin: 0pt;
      page-break-after: always;
      text-indent: 0;
      width: 100%;
      height: 100%;
      }
  
      body.fullpage {
         margin: 0;
         padding: 0;
  }
  </code></pre>
  
  <p>The background color is not mandatory, I like it this way.<br>
  Do not forget to <strong>add an alt</strong>, as the <em>alt</em> tag improves the accessibility.</p>
  
  <hr>
  
  <p>When a reader doesn't support SVG, there's another solution: you replace the SVG code by this one for Epub2, with a div that will show the cover without border, full page, </p>
  
  <p>Source: <a href="https://ebookflightdeck.com/handbook/coverimage" rel="nofollow noreferrer">https://ebookflightdeck.com/handbook/coverimage</a></p>
  
  <p>This CSS code will insure the cover is shown without margin, full page. For Epub2 and Epub3:</p>
  
  <pre><code>body.fullpage {
     margin: 0;
     padding: 0;
  }
  </code></pre>
  
  <p>This CSS code will insure the cover is centered:</p>
  
  <p>Epub2:</p>
  
  <pre><code>div.cover {
     text-align: center;
  }
  </code></pre>
  
  <p>Epub3;</p>
  
  <pre><code>section.cover {
     display: block;
     text-align: center;
  } 
  </code></pre>
  
  <p>In the link I provided, they tell us to use this CSS code to force the image to scale the reader screen:</p>
  
  <pre><code>body.fullpage {
     margin: 0;
     padding: 0;
  }
  section.cover {
     display: block;
     text-align: center;
     height: 95%;
  }
  img#coverimage {
     height: 95%;
  }
  
  img#coverimage:only-of-type { /*overrides the previous setting, but only in newer systems that support CSS3 */
     height: 95vh;
  }
  </code></pre>
  
  <ul>
  <li>Now the .xtml code on the page where the cover is included:</li>
  </ul>
  
  <p>For Epub2:</p>
  
  <pre><code>&lt;body class="fullpage"&gt;
     &lt;div class="cover"&gt;
        &lt;img id="coverimage" src="images/cover.jpg" alt="cover image" /&gt;
     &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>For Epub3:</p>
  
  <pre><code>&lt;body class="fullpage"&gt;
     &lt;section class="cover" **epub:type="cover"**&gt;
        &lt;img id="coverimage" src="images/cover.jpg" alt="cover image" /&gt;
     &lt;/section&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>You can change some code, id, name, if you want, but a good practice is to name your cover image, "cover.jpg" or "cover.png" (I suggest you to make some tests with your image, if you can allow to use jpg, it's smaller, but not always clearer.), in a few cases, they enter the ISBN as a name for the cover, but cover.jpg is the most common.</p>
  
  <hr>
  
  <p>Now, you have to check if the cover is correctly mentioned in the manifest .opf,
  the name of the file is content.opf. Those lines are mandatory in the .opf file:</p>
  
  <p>The CSS sheet in the <code>&lt;manifest&gt;... &lt;/manifest&gt;</code> section for Epub2:</p>
  
  <pre><code>&lt;item href="cover.jpg" id="cover-image" media-type="image/jpeg" /&gt;
  </code></pre>
  
  <p>For Epub3:</p>
  
  <pre><code> &lt;item href="cover.jpg" id="cover-image" media-type="image/jpeg" **properties="cover-image"**/&gt;
  </code></pre>
  
  <p>The image cover, in the <code>&lt;manifest&gt;</code> section too:</p>
  
  <pre><code>&lt;item id="cover.png" href="Images/cover.png" media-type="image/png"/&gt;
  </code></pre>
  
  <p>The .xhtml file in the <code>&lt;manifest&gt;</code> section too:</p>
  
  <pre><code>&lt;item id="cover.xhtml" href="Text/cover.xhtml" media-type="application/xhtml+xml"/&gt;
  </code></pre>
  
  <p>In the <code>&lt;metadata&gt;.... &lt;/metadata&gt;</code> section, only for Epub2:</p>
  
  <pre><code>&lt;meta name="cover" content="cover.png" /&gt;
  </code></pre>
  
  <hr>
  
  <p>I have also the cover mentioned in the guide section:</p>
  
  <pre><code>&lt;guide&gt;
  &lt;reference type="cover" title="Couverture" href="Text/cover.xhtml"/&gt;
  &lt;/guide&gt;
  </code></pre>
  
  <p>But don't do that it's a Kindle: </p>
  
  <blockquote>
    <p>Kindle Cover Image NOT to be referenced in the guide</p>
  </blockquote>
  
  <p>Source: <a href="http://www.rshelton.org/2014/11/how-to-understand-spine-and-guide-in.html" rel="nofollow noreferrer">http://www.rshelton.org/2014/11/how-to-understand-spine-and-guide-in.html</a></p>
  
  <p>For the spine, it's not mandatory. Only if you want your cover in the toc.</p>
  
  <pre><code>&lt;spine toc="ncx"&gt;
      &lt;itemref idref="cover.xhtml"/&gt;
  &lt;/spine&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T07:47:19.907Z
Answers.LastActivityDate: 2019-06-05T08:13:33.233Z
Answers.LastEditDate: 2019-06-05T08:13:33.233Z
Answers.UserDisplayName: Quidam
Answers.Body: <p>I Just Use a Word Editor like Microsft Word, Google Docs, Or libre Office &amp; Put the cover as an image filling the whole first page of the document, I would also put other images in like you would when writing in a Document. I then save it as a PDF Then Convert it to an Epub, that way you can save the formating you have done when writting.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-04T17:21:21.007Z
Answers.LastActivityDate: 2024-03-04T17:21:21.007Z
Answers.UserDisplayName: PaulGamerBoy360
Body: <p>If I am creating an ePub file by hand, from scratch (following a recipe such as <a href="https://ebooks.stackexchange.com/questions/1183/what-is-the-minimum-required-content-for-a-valid-epub">laid out in this question</a>), how would I go about adding pictures to the file? In particular, is there anything special that I need to do for a cover image?</p>
  
Tags: <epub><creation><production>
Title: How do I add a cover (and other pictures) to my ePub?
UserDisplayName: Donald.McLean
ThreadText: # How do I add a cover (and other pictures) to my ePub?
  
  (Asked by: username_0 on 2014-03-28)
  
  If I am creating an ePub file by hand, from scratch (following a recipe such as [laid out in this question](https://ebooks.stackexchange.com/questions/1183/what-is-the-minimum-required-content-for-a-valid-epub)), how would I go about adding pictures to the file? In particular, is there anything special that I need to do for a cover image?
  
  **Tags:** epub, creation, production
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2014-03-28. Score: 10
  
  Images in general should be added just as they would be in HTML, with an `<img>` tag. The image files themselves should then be included in the OEBPS folder or a subfolder (I generally use a subfolder, personally). Each image file will need to be declared in the `<manifest>` section of the content.opf file. As mentioned in the [epub 3.0 specifications](http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-item-property-values), the cover image in particular should also have the `cover-image` property assigned to it in the `<manifest>`, like so:
  
  ```
  <item id="cover_jpg" properties="cover-image" href="images/cover.jpg" media-type="image/jpeg" />
  
  ```
  
  The `<manifest>` entry for non-cover images is the same, just without the `properties="cover-image"` bit.
  
  That's it for plain epub, but some retailers will also ask for a `<meta>` element in the `<metadata>` section of the content.opf file declaring the cover, like so (from Amazon's [Kindle Publishing Guidelines](http://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf%E2%80%8E)):
  
  ```
  <meta name="cover" content="images/cover.jpg" />
  
  ```
  
  Note that Amazon in particular no longer requires the `<meta>` bit as long as the `properties="cover-image"` is correctly declared.
  
  
  ---
  
  ### Answer by username_2 on 2019-06-05. Score: 2
  
  I suggest you use Sigil, or another ebook creator software.
  
  Don't start from scratch with an .html file, it's more complicated, start from scratch with a sofware. I can list the things that you can have with that kind of sofwares that you'll have automatically, and that you couldn't have with a non specialised software.
  
  And be careful if you use a word processor, or an on specialised software, they include a lot of code that is not compatible with the ebook formats. You have to fix everything by reviewing all the code by yourself, so they are not recommendable to do that.
  
  * First, it's good practice that you insert the cover as the first .xhtml page in your ebook.
  * A good book cover should:
  * Allow to read clearly, even when the image is small.
  * Have a good look in a black and white reader.
  * Have a good size.
  
  Amazon, for instance, says:
  
  > Your cover image must be less than 50MB. Try to avoid compressing your
  > files. This can affect the quality of your cover when displayed on
  > reading devices. For the best results, images should have a minimum
  > resolution of 300 PPI (pixels per inch).
  
  And:
  
  > The ideal size of your eBook cover art is a height/width ratio of
  > 1.6:1. This means that for every 1,000 pixels in width, the image should be 1,600 pixels in height. To ensure the best quality for your
  > image, particularly on high definition devices, the height of the
  > image should be at least 2,500 pixels. Ideal dimensions for cover
  > files are 2,560 x 1,600 pixels.
  >
  > Note: The minimum image size allowed is 1,000 x 625 pixels. The
  > maximum image size allowed is 10,000 x 10,000 pixels.
  
  -
  
  * Sigil for instance automatically include the cover image in a wrapper.
  
  The advantage, is that .SVG files have a little size, and resize very well, without losing clarity. The goal is to have the cover automatically resizing according to the reader screen, that can be very different from one reader to another.
  
  The disavantage is that some readers doesn't support SVG (you have to check if it's the case for the reader you target, I don't know which ones, the link I mentioned tells us that they do exist.). Each time it's possible, if it's supported, use rather SVG and nothing else.
  
  * Create a CSS sheet for the cover. Call it cover.css, not mandatory, but clearer and easier to manage.
  * So insert an image in your ebook file with the software, click add a cover, choose the image as a cover (you can also right-click on the image, go in the semantic menu, and choose the cover as the semantic, those 2 ways can turn an image into a cover)
  * Name the .xhtml generated by your software as cover.xhtml.
    Then link the cover.css with the cover.xhtml.
  
  It's automatically made in the software by right-clicking on the .xhtml file and associate the .xhtml to a CSS, and you choose the name of the CSS file.
  
  To make it manually, in the head section of you .xtml file:
  
  ```
  <link href="../Styles/cover.css" type="text/css" rel="stylesheet"/>
  
  ```
  
  * This is the .xhtml code generated by Sigil for the cover of my book, this is the code for the whole page:
  
  ````
  
      
      
  ````
  
  ```
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Cover</title>
  <link href="../Styles/cover.css" type="text/css" rel="stylesheet"/>
  </head>
  
  <body class="fullpage">
    <div class="cover" id="cover">
      <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 1410 2250" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink">
        <image id="coverimage" alt="cover image" width="1410" height="2250" xlink:href="../Images/cover.png"/>
      </svg>
    </div>
  </body>
  </html>
  
  ```
  
  My CSS code in cover.css:
  
  ```
     .cover{
      background-color: grey;
      text-align: center;
      padding: 0pt;
      margin: 0pt;
      page-break-after: always;
      text-indent: 0;
      width: 100%;
      height: 100%;
      }
  
      body.fullpage {
         margin: 0;
         padding: 0;
  }
  
  ```
  
  The background color is not mandatory, I like it this way.  
  Do not forget to **add an alt**, as the *alt* tag improves the accessibility.
  
  ---
  
  When a reader doesn't support SVG, there's another solution: you replace the SVG code by this one for Epub2, with a div that will show the cover without border, full page,
  
  Source: <https://ebookflightdeck.com/handbook/coverimage>
  
  This CSS code will insure the cover is shown without margin, full page. For Epub2 and Epub3:
  
  ```
  body.fullpage {
     margin: 0;
     padding: 0;
  }
  
  ```
  
  This CSS code will insure the cover is centered:
  
  Epub2:
  
  ```
  div.cover {
     text-align: center;
  }
  
  ```
  
  Epub3;
  
  ```
  section.cover {
     display: block;
     text-align: center;
  } 
  
  ```
  
  In the link I provided, they tell us to use this CSS code to force the image to scale the reader screen:
  
  ```
  body.fullpage {
     margin: 0;
     padding: 0;
  }
  section.cover {
     display: block;
     text-align: center;
     height: 95%;
  }
  img#coverimage {
     height: 95%;
  }
  
  img#coverimage:only-of-type { /*overrides the previous setting, but only in newer systems that support CSS3 */
     height: 95vh;
  }
  
  ```
  
  * Now the .xtml code on the page where the cover is included:
  
  For Epub2:
  
  ```
  <body class="fullpage">
     <div class="cover">
        <img id="coverimage" src="images/cover.jpg" alt="cover image" />
     </div>
  </body>
  
  ```
  
  For Epub3:
  
  ```
  <body class="fullpage">
     <section class="cover" **epub:type="cover"**>
        <img id="coverimage" src="images/cover.jpg" alt="cover image" />
     </section>
  </body>
  
  ```
  
  You can change some code, id, name, if you want, but a good practice is to name your cover image, "cover.jpg" or "cover.png" (I suggest you to make some tests with your image, if you can allow to use jpg, it's smaller, but not always clearer.), in a few cases, they enter the ISBN as a name for the cover, but cover.jpg is the most common.
  
  ---
  
  Now, you have to check if the cover is correctly mentioned in the manifest .opf,
  the name of the file is content.opf. Those lines are mandatory in the .opf file:
  
  The CSS sheet in the `<manifest>... </manifest>` section for Epub2:
  
  ```
  <item href="cover.jpg" id="cover-image" media-type="image/jpeg" />
  
  ```
  
  For Epub3:
  
  ```
   <item href="cover.jpg" id="cover-image" media-type="image/jpeg" **properties="cover-image"**/>
  
  ```
  
  The image cover, in the `<manifest>` section too:
  
  ```
  <item id="cover.png" href="Images/cover.png" media-type="image/png"/>
  
  ```
  
  The .xhtml file in the `<manifest>` section too:
  
  ```
  <item id="cover.xhtml" href="Text/cover.xhtml" media-type="application/xhtml+xml"/>
  
  ```
  
  In the `<metadata>.... </metadata>` section, only for Epub2:
  
  ```
  <meta name="cover" content="cover.png" />
  
  ```
  
  ---
  
  I have also the cover mentioned in the guide section:
  
  ```
  <guide>
  <reference type="cover" title="Couverture" href="Text/cover.xhtml"/>
  </guide>
  
  ```
  
  But don't do that it's a Kindle:
  
  > Kindle Cover Image NOT to be referenced in the guide
  
  Source: <http://www.rshelton.org/2014/11/how-to-understand-spine-and-guide-in.html>
  
  For the spine, it's not mandatory. Only if you want your cover in the toc.
  
  ```
  <spine toc="ncx">
      <itemref idref="cover.xhtml"/>
  </spine>
  
  ```
  
  
  ---
  
  ### Answer by username_3 on 2024-03-04. Score: 0
  
  I Just Use a Word Editor like Microsft Word, Google Docs, Or libre Office & Put the cover as an image filling the whole first page of the document, I would also put other images in like you would when writing in a Document. I then save it as a PDF Then Convert it to an Epub, that way you can save the formating you have done when writting.
  
  
  ---
  
  