@mocanvas/editor · interface
interface TLImageExportOptions extends EditorSvgExportOptionsOptions for a raster export (toImage, toImageDataUrl).
Extends the SVG options because a raster export *is* an SVG export with one more stage: everything that decides what the picture contains is shared, and only the encoding is not.
Properties · 6
bounds?: BoxLikeThe page-space rectangle to export. Defaults to the bounds of the shapes.
format?: TLExportTypeOutput format. Defaults to "png".
padding?: number | "auto"Space left around the shapes.
"auto" renders with the editor's default padding and then trims back to
the visual content, which is what catches a thick stroke or an arrowhead
that overhangs its shape's bounds without leaving a margin of empty space.
A number is fixed padding, and clips anything past it; 0 is neither.
pixelRatio?: numberMultiplier on the output's pixel dimensions. Defaults to 2, which is
sharp on the high-DPI display most people are looking at; raise it for
print.
Distinct from scale, which changes the *logical* size — the coordinate
system the shapes are drawn in. Doubling the scale makes a 100pt shape
200pt; doubling the pixel ratio leaves it 100pt and gives it four times as
many pixels.
preserveAspectRatio?: stringThe SVG preserveAspectRatio attribute, verbatim.
quality?: numberEncoder quality for the lossy formats, 0–1. Ignored by PNG and SVG.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.