def convert_images(self, pages, opts, wide): from calibre.ebooks.lrf.pylrs.pylrs import Book, BookSetting, ImageStream, ImageBlock from uuid import uuid4 from calibre.constants import __appname__, __version__ width, height = (784, 1012) if wide else (584, 754) ps = {} ps['topmargin'] = 0 ps['evensidemargin'] = 0 ps['oddsidemargin'] = 0 ps['textwidth'] = width ps['textheight'] = height book = Book(title=opts.title, author=opts.author, bookid=uuid4().hex, publisher='%s %s'%(__appname__, __version__), category=_('Comic'), pagestyledefault=ps, booksetting=BookSetting(screenwidth=width, screenheight=height)) for page in pages: imageStream = ImageStream(page) _page = book.create_page() _page.append(ImageBlock(refstream=imageStream, blockwidth=width, blockheight=height, xsize=width, ysize=height, x1=width, y1=height)) book.append(_page) book.renderLrf(open(opts.output, 'wb'))
def convert_images(self, pages, opts, wide): from calibre.ebooks.lrf.pylrs.pylrs import Book, BookSetting, ImageStream, ImageBlock from uuid import uuid4 from calibre.constants import __appname__, __version__ width, height = (784, 1012) if wide else (584, 754) ps = {} ps['topmargin'] = 0 ps['evensidemargin'] = 0 ps['oddsidemargin'] = 0 ps['textwidth'] = width ps['textheight'] = height book = Book(title=opts.title, author=opts.author, bookid=uuid4().hex, publisher='%s %s' % (__appname__, __version__), category=_('Comic'), pagestyledefault=ps, booksetting=BookSetting(screenwidth=width, screenheight=height)) for page in pages: imageStream = ImageStream(page) _page = book.create_page() _page.append( ImageBlock(refstream=imageStream, blockwidth=width, blockheight=height, xsize=width, ysize=height, x1=width, y1=height)) book.append(_page) book.renderLrf(open(opts.output, 'wb'))