if not (options.output_file or options.output_dir):
output_file = os.path.splitext(main_input)[0] + '.' + cls.ext
else:
- output_file = None
+ output_file = options.output_file
# Do the transformation.
doc = WLDocument.from_file(main_input, provider=provider, **parser_args)
self.title = book_info.title
if format is not None:
self.format = format
+ if width and height:
+ self.height = height * self.width / width
scale = max(float(width or 0) / self.width, float(height or 0) / self.height)
if scale >= 1:
self.scale = scale
data = data.replace(u'\ufeff', '')
# assume images are in the same directory
- if image_store is None and xmlfile.name is not None:
+ if image_store is None and getattr(xmlfile, 'name', None):
image_store = ImageStore(path.dirname(xmlfile.name))
try: