From 2495b1cc62fe9b102abe250835256f0eb1d6f1d8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Feb 2010 19:47:37 -0700 Subject: [PATCH] When rescaling images, take margins into account, unless input document is a comic --- src/calibre/customize/profiles.py | 2 +- src/calibre/ebooks/conversion/plumber.py | 1 + src/calibre/ebooks/oeb/transforms/rescale.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 89e9a30111..1a8e43a233 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -235,7 +235,7 @@ class SonyReaderOutput(OutputProfile): description = _('This profile is intended for the SONY PRS line. ' 'The 500/505/600/700 etc.') - screen_size = (584, 775) + screen_size = (600, 775) dpi = 168.451 fbase = 12 fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24] diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 339f1f92ec..b6e7684c48 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -786,6 +786,7 @@ OptionRecommendation(name='timestamp', self.oeb = create_oebbook(self.log, self.oeb, self.opts, self.input_plugin) self.input_plugin.postprocess_book(self.oeb, self.opts, self.log) + self.opts.is_image_collection = self.input_plugin.is_image_collection pr = CompositeProgressReporter(0.34, 0.67, self.ui_reporter) self.flush() if self.opts.debug_pipeline is not None: diff --git a/src/calibre/ebooks/oeb/transforms/rescale.py b/src/calibre/ebooks/oeb/transforms/rescale.py index 6ed863929c..df4cc206a2 100644 --- a/src/calibre/ebooks/oeb/transforms/rescale.py +++ b/src/calibre/ebooks/oeb/transforms/rescale.py @@ -29,6 +29,9 @@ class RescaleImages(object): page_width, page_height = self.opts.dest.width, self.opts.dest.height + if not self.opts.is_image_collection: + page_width -= (self.opts.margin_left + self.opts.margin_right) * self.opts.dest.dpi/72. + page_height -= (self.opts.margin_top + self.opts.margin_bottom) * self.opts.dest.dpi/72. for item in self.oeb.manifest: if item.media_type.startswith('image'): raw = item.data