6

Under Ubuntu 12.04 I converted with Calibre an html source to epub format, but when I read the resulting epub with Calibre I noticed (using the 'inspect' command of Calibre viewer) that images get some additional styling, absent both in original html and in html that epub is made of. For example,

<img src="copertina_retro.jpg" alt="pict" width="100%"/>

in html becomes

<img src="copertina_retro.jpg" alt="pict" width="100%" 
    style="height: 502px; width: 351.91752577319585px; ">

inside Calibre viewer, when inspecting the image. This prevents me to make manual modifications to the size of a single image.

How can I avoid such 'restyling'?

Does it happen just with Calibre viewer or it is typical behaviour of ebook readers?

6
  • 2
    hello mmj, have you tried tex4ebook (github.com/michal-h21/tex4ebook ) instead of Calibre? It is based on tex4ht and creates epub or mobi files directly from LaTeX
    – michal.h21
    Jan 10, 2014 at 19:11
  • This style is absent in the epub but visible in the viewer?
    – his
    Jan 11, 2014 at 8:23
  • hi michal, didn't know about tex4ebook I will surely try it.
    – mmj
    Jan 12, 2014 at 9:59
  • @his. Yes, the 1st line I reported above is from the epub source, the 2nd line is the same line as 'inspected' from Calibre viewer.
    – mmj
    Jan 12, 2014 at 10:03
  • So it is just a computed style from that specific viewer software. Why does it prevent you to make manual modifications? Will it be overwritten by this specific value all the time and is the value wrong?
    – his
    Jan 12, 2014 at 13:37

1 Answer 1

2

Testing this it seems that this is simply a quirk of Calibre's ebook viewer. It adds the absolute calculated size of the image dynamically into the source. This size changes when you resize the window (with the inspector window open it shows continuously). Whether max-width and max-height styles are set by the viewer depends on the viewing mode. In page mode (default) these values are set, they seem to be needed for the calculation. In continuous mode your values will not be overridden.

So this is just a quirk of that specific software. You can't change it, you can't draw any conclusions about the behaviour of other software; e.g. my Sony T2 doesn't set own max-width leading to pictures that are not completely visible. In fact I would prefer the intelligent behaviour of Calibre viewer here. FBReader resizes the image to a smaller size to fit it into the width.

Sizes smaller than 100% or the current pixel width can be used without problems, Calibre does not ignore it in either mode. (Absolute pixel widths are obviously a bad idea in any case.)

You can set the values to your needs. As different applications use different heuristics to produce a readable rendering you should stay as close to a semantic markup as possible to be able to ignore such additional output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.