imagecat.operator.render module

Functions that generate new image data.

imagecat.operator.render.text(graph, name, inputs)[source]

Generate an image containing text.

Parameters
  • graph (Graph, required) – Graph that owns this task.

  • name (hashable object, required) – Name of the task executing this function.

  • inputs (Named Inputs, required) – Inputs for this operator.

Named Inputs
  • anchor (str, optional) – Anchor point for text placement, defined at https://pillow.readthedocs.io/en/latest/handbook/text-anchors.html#text-anchors. Defaults to “mm”.

  • fontindex (integer, optional) – Index of the font to use within a multi-font file. Defaults to 0.

  • fontname (str, optional) – Path to a font file. Defaults to imagecat.data.default_font().

  • fontsize (Size of the rendered font, optional) – Default: “0.33h”, which is one-third the height of the output image.

  • layer (str, optional) – Name of the generated layer. Default: [“A”].

  • position ((x, y) tuple, optional) – Position of the text anchor relative to the output image. Default: [“0.5w”, “0.5h”], which is centered vertically and horizontally.

  • res ((width, height) tuple, optional) – Resolution of the output image. Default: [256, 256].

  • string (str, optional) – String to be rendered. Default: “Text”.

Returns

image – New image containing rendered text.

Return type

imagecat.data.Image