Documentation Index
Fetch the complete documentation index at: https://mintlify.com/andresilva-cc/grafex/llms.txt
Use this file to discover all available pages before exploring further.
render() is the primary entry point for programmatic image generation in Grafex. It accepts a path to a .tsx composition file, transpiles and executes the file in Node.js, loads the resulting HTML into a headless browser, and returns a buffer containing the final image. The browser instance is created on the first call and reused for all subsequent calls within the same process, so there is no per-call launch overhead after the first render.
Signature
Parameters
Path to the
.tsx composition file. Relative paths are resolved from the current working directory of the Node.js process.Optional configuration object. All fields override the values in the composition’s
config export. If a field is not provided, the value from config (or the named variant’s config) is used; if neither is set, the documented default applies.Return value
Returns aPromise that resolves to a RenderResult object.
Raw image data. Write directly to a file with
fs.writeFile or pipe into another stream.Effective render width in pixels, after applying
scale. A 1200px composition with scale: 2 returns width: 2400.Effective render height in pixels, after applying
scale. A 630px composition with scale: 2 returns height: 1260.The device pixel ratio used for this render.
The output format used. Reflects whichever source (call options → variant config → base config → default) provided the final value.
Examples
Option values set in the call always override the composition’s
config export. The resolution order is: call options → variant config → base config → built-in default.