Answers.Body: <p>First, I don't know the specifics of using Calibre for images, but here is the css code I use to make images work in epubs which will be converted by kindlegen to Kindle. </p>
  
  <p><a href="https://ebooks.stackexchange.com/a/6515/417">https://ebooks.stackexchange.com/a/6515/417</a></p>
  
  <p>Generally I upload d a high resolution image and then specify the width for certain sizes. Kindlegen will downconvert the images as needed. </p>
  
  <p>From my example, I said that width was 95%, but you can make it 30%, 50%, whatever. </p>
  
  <p>I don't know why you're using ex as units -- especially because you dealing with images of text rather than actual fonts as text. I'm guessing you're looking at autogenerated code from MS Word or Indesign? </p>
  
  <p>For more background about formatting images for kindles, see their publishing guidelines. <a href="http://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf" rel="nofollow noreferrer">http://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf</a></p>
  
  <p>Eventually I imagine you could use MathML instead of a graphic, but that's not supported yet in Kindle. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-09T22:20:15.297Z
Answers.Text: I am using `ex` in the hope that the images rescale themselves whenever the user of the ebook reader changes the font size.  The text in the images is meant to have the same size as the real text, for all font sizes.  Is there a better way of achieving this?
Answers.UserDisplayName: jochen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-10T19:09:16.693Z
Answers.Text: Fascinating idea. I didn't realize that ex could be used in that fashion. I'll have to try it out.
Answers.UserDisplayName: idiotprogrammer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-17T22:28:30.203Z
Answers.Text: The approach works nicely for me, both in a web browser (after unpacking the epub) and in epub readers.  The only thing which fails is conversion to `.mobi` using Calibre.
Answers.UserDisplayName: jochen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-09T22:13:04.927Z
Answers.LastActivityDate: 2016-09-09T22:13:04.927Z
Answers.LastEditDate: 2017-04-13T13:00:05.480Z
Answers.UserDisplayName: idiotprogrammer
Body: <p>I am trying to create an book for use on my Kindle.  The text has mathematical inline formulas rendered as images and for the formulas to fit in well, the images need to scale with the text size.  I got this to work for epub files, using tags like <code>&lt;img src="int.png" style="width: 20.35ex; height: 3.76ex; vertical-align: middle"/&gt;</code>, but when I convert the epub file to mobi format, the image scaling breaks and the formulas come out the wrong size, looking for example like this oversized <a href="https://i.sstatic.net/VVKTk.png" rel="noreferrer"><img src="https://i.sstatic.net/VVKTk.png" alt="some integral"></a> integral.</p>
  
  <p>Is there a way to make my images scale proportional to the font size on a Kindle, either in a mobi file, or in any other format the kindle will display?</p>
  
  <p>Updates:</p>
  
  <ol>
  <li>I am using Calibre to convert epub to mobi.</li>
  <li>The approach described above works with Amazon's <code>kindlegen</code> utility.  Because of kindlegen's somewhat restrictive term's of use, I am still looking for a solution which works with Calibre.</li>
  </ol>
  
Tags: <mobi><image>
Title: How to make images scale with text size on an Amazon Kindle?
UserDisplayName: jochen
ThreadText: # How to make images scale with text size on an Amazon Kindle?
  
  (Asked by: username_0 on 2016-09-09)
  
  I am trying to create an book for use on my Kindle. The text has mathematical inline formulas rendered as images and for the formulas to fit in well, the images need to scale with the text size. I got this to work for epub files, using tags like `<img src="int.png" style="width: 20.35ex; height: 3.76ex; vertical-align: middle"/>`, but when I convert the epub file to mobi format, the image scaling breaks and the formulas come out the wrong size, looking for example like this oversized [![some integral](https://i.sstatic.net/VVKTk.png)](https://i.sstatic.net/VVKTk.png) integral.
  
  Is there a way to make my images scale proportional to the font size on a Kindle, either in a mobi file, or in any other format the kindle will display?
  
  Updates:
  
  1. I am using Calibre to convert epub to mobi.
  2. The approach described above works with Amazon's `kindlegen` utility. Because of kindlegen's somewhat restrictive term's of use, I am still looking for a solution which works with Calibre.
  
  **Tags:** mobi, image
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-09. Score: 1
  
  First, I don't know the specifics of using Calibre for images, but here is the css code I use to make images work in epubs which will be converted by kindlegen to Kindle.
  
  <https://ebooks.stackexchange.com/a/6515/417>
  
  Generally I upload d a high resolution image and then specify the width for certain sizes. Kindlegen will downconvert the images as needed.
  
  From my example, I said that width was 95%, but you can make it 30%, 50%, whatever.
  
  I don't know why you're using ex as units -- especially because you dealing with images of text rather than actual fonts as text. I'm guessing you're looking at autogenerated code from MS Word or Indesign?
  
  For more background about formatting images for kindles, see their publishing guidelines. <http://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf>
  
  Eventually I imagine you could use MathML instead of a graphic, but that's not supported yet in Kindle.
  
  > **Comments:**
  > **username_0**: I am using `ex` in the hope that the images rescale themselves whenever the user of the ebook reader changes the font size.  The text in the images is meant to have the same size as the real text, for all font sizes.  Is there a better way of achieving this?  
  > **username_1**: Fascinating idea. I didn't realize that ex could be used in that fashion. I'll have to try it out.  
  > **username_0**: The approach works nicely for me, both in a web browser (after unpacking the epub) and in epub readers.  The only thing which fails is conversion to `.mobi` using Calibre.  
  
  ---
  
  