PNGRenderer#

Qualified name: manimpango.PNGRenderer

class PNGRenderer#

PNGRenderer is a renderer which renders the Layout to an PNG file.

The file_name is opened when the class is initialised and only closed when the renderer is destroyed.

Parameters
  • file_name (str) – The path to PNG file.

  • width (float) – The width of the PNG.

  • height (float) – The height of the PNG.

  • layout (Layout) – The Layout that needs to be rendered.

Example

>>> import manimpango as mp
>>> a = mp.PNGRenderer('test.svg', 100, 100, mp.Layout('hello'))
>>> a
<PNGRenderer file_name='test.svg' width=100.0 height=100.0 layout=<Layout text='hello' markup=None>
>>> a.render()
True
Raises

Exception – Any error reported by cairo.

Methods

render

render() actually does the rendering.

file_name#

The file_name where the file is rendered onto

height#

The height of the PNG.

layout#

The Layout which is being rendered.

render()#

render() actually does the rendering. Any error reported by Cairo is reported as an exception. If this method suceeds you can expect an valid PNG file at file_name.

Returns

True if the function worked, else False.

Return type

bool

width#

The width of the PNG.