vibesketch.render

Publication graphics from the normalized document.

Exports render on the server from the document, not from the canvas picture, so a batch from the CLI looks the same as the button (roadmap, section 3.3). Each structure is drawn by RDKit in the ACS 1996 style (RDKit’s ACS 1996 mode: 14.4 pt bonds, 0.6 pt lines, 10 pt Arial labels) from the coordinates it has on the canvas. A scheme is composed around the structures: plus signs, the arrow, reagents above it, condition lines and the yield below it, and bold compound numbers under each structure.

SVG covers everything. PNG covers a single structure (RDKit’s Cairo backend); a PNG of a scheme needs the publication renderer (roadmap WP 3.2) and is refused with that reason. The browser can rasterize the SVG.

Module Attributes

STYLES

The style presets this version can draw.

Functions

render(document, fmt, *[, style])

The document as svg or png; raises RenderRefused.

render_svg(document, *[, style])

The document as an SVG figure: its reactions, or its species in a row.

thumbnail(document)

A PNG of the document's species side by side, for file previews.

Exceptions

RenderRefused

The document cannot be rendered in the requested format or style.

RenderUnavailable

This machine lacks a system library that RDKit's drawing code needs.

vibesketch.render.STYLES = ('acs-1996',)

The style presets this version can draw.

exception vibesketch.render.RenderRefused

Bases: ValueError

The document cannot be rendered in the requested format or style.

exception vibesketch.render.RenderUnavailable

Bases: RuntimeError

This machine lacks a system library that RDKit’s drawing code needs.

vibesketch.render.render(document, fmt, *, style='acs-1996')

The document as svg or png; raises RenderRefused.

Parameters:
Return type:

bytes

vibesketch.render.render_svg(document, *, style='acs-1996')

The document as an SVG figure: its reactions, or its species in a row.

Parameters:
Return type:

bytes

vibesketch.render.thumbnail(document)

A PNG of the document’s species side by side, for file previews.

The panels shrink so the longest side stays within 1024 pixels; one species fills a panel of 300 by 225. Returns the PNG, its width and its height. Raises RenderRefused for a document without species and RenderUnavailable without the drawing libraries.

Parameters:

document (Document)

Return type:

tuple[bytes, int, int]