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.
RenderResult is the object returned by both render() and renderAll(). It carries the raw image bytes alongside the metadata that describes exactly how the image was produced — the effective dimensions, the device pixel ratio, and the format. Use this metadata to build correct filenames, log output details, or pass the image dimensions downstream to other systems without re-reading the file.
Interface
Fields
A Node.js
Buffer containing the raw encoded image bytes — PNG or JPEG depending on the format used. Write it directly to disk with fs.writeFileSync, pipe it into a stream, or pass it to an upload function. No base64 decoding or conversion is needed.The effective render width in logical pixels — the viewport width the composition’s layout was calculated against, before the scale factor is applied. This matches the
width value from CompositionConfig, VariantConfig, or the RenderOptions override (whichever had the highest precedence).The physical pixel width of the image is width × scale.The effective render height in logical pixels — the viewport height the composition’s layout was calculated against, before the scale factor is applied.The physical pixel height of the image is
height × scale.The device pixel ratio that was applied during rendering. A
scale of 1 means logical and physical pixels are identical. A scale of 2 means every logical pixel maps to a 2×2 block of physical pixels, doubling the resolution in each dimension.Use width * scale and height * scale to compute the actual pixel dimensions of the image in buffer.The image format that was actually used to encode the buffer. This reflects the resolved format after the merge chain —
RenderOptions → VariantConfig → CompositionConfig → default ('png'). Use this value when constructing output filenames to ensure the extension matches the encoding.Usage examples
Write to disk and log dimensions
Save all variants with correct filenames
Upload the buffer directly
Becausebuffer is a standard Node.js Buffer, you can pass it to any API that accepts binary data without writing a temporary file first.