scistag.emojistag.emoji_renderer.render_emoji

render_emoji(identifier, size=None, width=None, height=None, bg_color=None, quality=90)[source]

Tries to read an emoji and render it to a transparent image

Parameters
  • identifier (str | list[str]) – The emoji’s markdown identifier such as :deer:, the official unicode name such as “deer”, the unicode sequence, e.g. [“u1f98c”] for a stag or just the emoji as single character.

  • size (int | None | Size2DTypes) – The size in pixels in which the emoji shall be rendered. By default the original Noto Emoji data set will be used providing the Emojis in a 136x128 resolution.

  • width (float) – The desired emoji width. The height will be computed automatically.

  • height (float) – The desired emoji height. The width will be computed automatically.

  • bg_color (ColorTypes | None) – The color with which the background of the emoji shall be filled. By default the emoji will be a transparent RGBA image.

  • quality (int) –

    The desired quality. By default the renderer will try to use pre-rendered PNGs if the requested emoji size is small (<=136x128). These images are slightly quantized. If you want to maximize the image quality at all costs, you can set this value to >90 to enforce SVG rendering.

    This requires the SVG package to be installed.

    See python3 -m scistag.addons for details.

    If a very small value is passed (<50) SVG rendering will never be used.

Return type

Image | None

Returns

The emoji as image.