Here's a more complete example of using inline images. I had to Refactor the inheritance rules in pylrs a bit.
Code:
from libprs500.lrf.pylrs.pylrs import *
"""
TextBlocks can be added to any page at any time, since the entire book is
kept in memory. Text can also be added to any paragraph at any time.
"""
def helloworld():
book = Book()
istr = ImageStream('/tmp/try/cherubs.jpg')
im = Image(istr, x0=0, y0=0, x1=300, y1=300, xsize=100, ysize=100)
page = book.Page()
page.TextBlock().Paragraph(Span('Demonstration of embedded graphics', fontsize='180')).CR()
p = page.TextBlock().Paragraph('The image: ')
p.append(Plot(im, xsize=550, ysize=550))
page.TextBlock(TextStyle(), BlockStyle(blockrule='vert-fixed'))
page.TextBlock().Paragraph(Bold('Drop caps')).CR()
textBlock = page.TextBlock()
textBlock.blockStyle = BlockStyle(blockrule='horz-fixed', blockwidth='575')
p = Paragraph('This line of text is before the graphic. ')
dc = DropCaps(lines=3)
dc.append(Plot(im, xsize=450, ysize=450))
p.append(dc)
textBlock.append(p)
textBlock.Paragraph('This line of text is after the graphic. It needs to be long enough to ensure that the graphic is not cut-off.')
page.TextBlock().Paragraph(Bold('Inline graphic')).CR()
page.TextBlock(TextStyle(), BlockStyle(blockrule='vert-fixed'))
tb = page.TextBlock()
p = tb.Paragraph('This line of text is before the graphic.')
p.append(Plot(im, xsize=350, ysize=350))
p.append('This line of text is after the graphic.')
book.renderLrs("/tmp/helloworld.lrs")
book.renderLrf("/home/kovid/helloworld.lrf")
if __name__ == "__main__":
helloworld()