createRenderer(), but can be instantiated directly if needed.
For complete type definitions and interfaces, see the Type
Definitions page.
Methods
getTemplate
Retrieves a template by its unique ID.Parameters
The template ID to look up
Returns
The template definition, or
undefined if not foundrenderToImage
Renders a template to a PNG image buffer. This is the main method for generating OG images.Parameters
The ID of the template to render
Parameters specific to the chosen template, or a function returning a Promise
of parameters. User-provided parameters override shared parameters.
Rendering options
Returns
A promise that resolves to the PNG image buffer
Rendering process
1
Template Lookup
Looks up the template by ID in the internal registry
2
Parameter Merging
Merges shared params with user paramsPriority: Parameters are merged with the following precedence
(highest to lowest):
paramspassed torenderToImage()sharedParamsfrom renderer configuration- Template default parameters
3
Cache Checking
Generates a cache key and checks for a cached PNG buffer
4
Inflight Deduplication
If an identical render is already in progress, returns the shared in-flight
promise instead of starting a duplicate render
5
Before Render Hook
Calls
beforeRender hook if configured6
Core Rendering
Delegates to the core rendering engine
7
Cache Storage
Caches the generated image
8
After Render Hook
Calls
afterRender hook if configured9
Return Buffer
Returns the PNG buffer