From 6bd56c0d5b94e342c919541b96e12f0ceab447d8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 14 Nov 2010 09:50:22 -0700 Subject: [PATCH] MOBI Output: Specify image sizes in pixels instead of em to accomodate Amazon's @#$%#@! MOBI renderer --- src/calibre/ebooks/mobi/mobiml.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 7e4e2e4f57..98e7b6023c 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -363,11 +363,15 @@ class MobiMLizer(object): if value == getattr(self.profile, prop): result = '100%' else: + # Amazon's renderer does not support + # img sizes in units other than px + # See #7520 for test case try: - ems = int(round(float(value) / self.profile.fbase)) + pixs = int(round(float(value) / \ + (72./self.profile.dpi))) except: continue - result = "%dem" % ems + result = "%d"%pixs istate.attrib[prop] = result elif tag == 'hr' and asfloat(style['width']) > 0: prop = style['width'] / self.profile.width