vibesketch.render

Publication graphics from the document’s drawing.

SVG preserves the KET scene’s coordinates, repeated molecule occurrences, arrows and annotations. RDKit draws molecules with the selected journal preset. Documents without a drawing fall back to rows composed from their species/reactions. The server, SDK, CLI, MCP and browser all use the same export implementation.

PNG and PDF use the optional publication backend, with the same scene SVG.

Functions

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

Render SVG, PNG, PDF, EPS or EMF; PNG DPI defaults to 300 (36–2400).

render_svg(document, *[, style, ...])

The drawing as an SVG figure, or reaction rows when no drawing exists.

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.

exception vibesketch.render.RenderRefused[source]

Bases: ValueError

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

exception vibesketch.render.RenderUnavailable[source]

Bases: RuntimeError

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

vibesketch.render.render(document, fmt, *, style=None, dpi=300, stereo_labels=False, sequences=False)[source]

Render SVG, PNG, PDF, EPS or EMF; PNG DPI defaults to 300 (36–2400).

EPS and EMF, for office documents, are written by vibe-sketch itself from the same SVG with the text outlined (vibesketch.render.vector).

Parameters:
Return type:

bytes

vibesketch.render.render_svg(document, *, style=None, stereo_labels=False, sequences=False)[source]

The drawing as an SVG figure, or reaction rows when no drawing exists.

With stereo_labels, CIP descriptors and enhanced-stereo groups are printed beside the structures, freshly assigned (vibesketch.chem.cip). With sequences, a species built from a sequence is printed as it, H-Tyr-Gly-OH or 5’-ACGU-3’, in place of its structure.

Parameters:
Return type:

bytes

vibesketch.render.thumbnail(document)[source]

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]

Modules

chemfig

chemfig source for LaTeX: structures as a walk with angles, schemes with arrows.

fonts

The reviewed Roboto font shared by publication SVG, PNG and PDF.

nanostructures

Nanostructure depictions for figures, chemfig and the canvas (#138).

publication

Optional resvg/svg2pdf publication backend, always consuming the scene SVG.

scene

SVG from a KET scene, retaining each occurrence and its drawing coordinates.

styles

Journal drawing parameters in print points; sources are also in formats.md.

surfaces

Validated schematic surface images.

vector

EPS and EMF figures for office documents, from the publication SVG (#96).