When you want an image to appear in a certain place in the text, insert something like this:
<p><img src=”fig64.jpg” alt=”fig64″ id=”figure64″/></p>
…where fig64.jpg is the name of the image file, and figure64 is the label you would use if you wanted to be able to jump to it by clicking on something like:
<a href=”#figure64″>fig. 6.4</a>
…from elsewhere in the book (including from the list of illustrations – see previous posting). When you use Calibre later, you will tell it where the html with the book’s text is, and all your images will also have to be in whatever folder encloses that html file. I never found out what alt=”fig64″ for example does.
You can only use .jpg or .gif picture files. A gif file describes the pixels row by row, with repeated codes that mean things like “next we have 247 pixels all of this colour”, and giving the exact definition of the pixel colour. That means diagrams with large blocks or lines all of the same colour are stored very efficiently.
In a jpg file, first a large area is described roughly with a large fuzzy blob. Then progressively smaller blobs are specified and superimposed or subtracted until the result is ‘good enough’. This means that jpg files are usually slightly compromised, but you can squeeze them to save space if you don’t mind accepting a bit of fuzziness or blotchiness. You can store readable text in a jpg file, in less space than in a gif file, but the jpg will look dismal, whereas the gif will be bright and perfect. Text in a perfect-looking jpg would need more file space than the gif. Pictures with colours that change gradually, need jpgs.
You might need your finished book to fit into a .mobi file below a certain size, say below 5MB if you’re using Smashwords, or below 10MB if you want to exploit free transmission with Amazon (only worthwhile for large books, e.g. with many pictures). I found occasionally that adding a gif file could increase the final mobi size by much more than the gif file size alone. I think this can happen if you let Calibre convert all gif files to jpgs, as detailed in a later posting.