Search Docs
Loading...
Skip to content

Create Cutout

Create cutout paths for cutting printers to produce die-cut stickers, iron-on decals, and custom-shaped prints programmatically.

Cutout paths demonstration showing circular and square cutouts combined

8 mins
estimated time
Download
StackBlitz
GitHub

Cutouts define outline paths that cutting printers cut with a blade rather than print with ink. CE.SDK supports creating cutouts from SVG paths, generating them from block contours, and combining them with boolean operations.

This guide covers creating cutouts programmatically from SVG paths, configuring cutout types and offsets, combining cutouts with boolean operations, customizing spot colors for printer compatibility, and integrating the cutout library plugin for interactive creation.

Understanding Cutouts#

Cutouts are special blocks that contain SVG paths interpreted by cutting printers as cut lines. Printers recognize cutouts through specially named spot colors: CutContour for solid continuous cuts and PerfCutContour for dashed perforated cuts.

The spot color RGB values affect on-screen rendering but not printer behavior. By default, solid cutouts render as magenta and dashed cutouts render as green.

Creating Cutouts from SVG Paths#

Create cutouts using engine.block.createCutoutFromPath(path) with standard SVG path syntax. The path coordinates define the cutout dimensions.

// Create a circular cutout from SVG path (scaled up for visibility)
const circle = engine.block.createCutoutFromPath(
'M 0,75 a 75,75 0 1,1 150,0 a 75,75 0 1,1 -150,0 Z'
);
engine.block.appendChild(page, circle);
engine.block.setPositionX(circle, 200);
engine.block.setPositionY(circle, 225);

The method accepts standard SVG path commands: M (move), L (line), H (horizontal), V (vertical), C (cubic curve), Q (quadratic curve), A (arc), and Z (close path).

Configuring Cutout Type#

Set the cutout type using engine.block.setEnum() to control whether the printer creates a continuous or perforated cut line.

// Set cutout type to Dashed for perforated cut line
engine.block.setEnum(circle, 'cutout/type', 'Dashed');

Solid creates a continuous cutting line (default), while Dashed creates a perforated cutting line for tear-away edges.

Configuring Cutout Offset#

Adjust the distance between the cutout line and the source path using engine.block.setFloat().

// Set cutout offset distance from source path
engine.block.setFloat(circle, 'cutout/offset', 5.0);

Positive offset values expand the cutout outward from the path. Use offset to add bleed or margin around designs for cleaner cuts.

Creating Multiple Cutouts#

Create additional cutouts with different properties to demonstrate various shapes and configurations.

// Create a square cutout with solid type (scaled up for visibility)
const square = engine.block.createCutoutFromPath('M 0,0 H 150 V 150 H 0 Z');
engine.block.appendChild(page, square);
engine.block.setPositionX(square, 450);
engine.block.setPositionY(square, 225);
engine.block.setFloat(square, 'cutout/offset', 8.0);

Each cutout can have independent type and offset settings based on your production requirements.

Combining Cutouts with Boolean Operations#

Combine multiple cutouts into compound shapes using engine.block.createCutoutFromOperation(ids, operation). Available operations are Union, Difference, Intersection, and XOR.

// Combine cutouts using Union operation
const combined = engine.block.createCutoutFromOperation(
[circle, square],
'Union'
);
engine.block.appendChild(page, combined);
engine.block.setPositionX(combined, 200);
engine.block.setPositionY(combined, 225);
// Destroy original cutouts to avoid duplicate cuts
engine.block.destroy(circle);
engine.block.destroy(square);

The combined cutout inherits the type from the first cutout in the array and has an offset of 0. Destroy the original cutouts after combining to avoid duplicate cuts.

Customizing Spot Colors#

Modify the spot color RGB approximation using engine.editor.setSpotColorRGB() to change how cutouts render without affecting printer behavior.

// Customize spot color RGB for rendering (bright blue for visibility)
engine.editor.setSpotColorRGB('CutContour', 0.0, 0.4, 0.9);

Spot color names (CutContour, PerfCutContour) are what printers recognize. Adjust the names if your printer uses different conventions.

Using the Cutout Library Plugin#

The @imgly/plugin-cutout-library-web plugin provides an interactive UI for creating cutouts directly in the editor. Users can add rectangular or elliptical cutouts from the asset library dock, or generate cutouts from selected shapes via the canvas menu.

Install the plugin:

bash npm install @imgly/plugin-cutout-library-web

Import and register the plugin:

import CutoutLibraryPlugin from '@imgly/plugin-cutout-library-web';

Add the plugin to your editor instance with canvas menu support:

// Add cutout library plugin for UI-based cutout creation
await cesdk.addPlugin(
CutoutLibraryPlugin({
ui: { locations: ['canvasMenu'] }
})
);

Configure the dock to display the cutout library and open it by default:

// Add cutout library to dock as the last entry
const cutoutAssetEntry = cesdk.ui.getAssetLibraryEntry(
'ly.img.cutout.entry'
);
cesdk.ui.setComponentOrder({ in: 'ly.img.dock' }, [
...cesdk.ui
.getComponentOrder({ in: 'ly.img.dock' })
.filter(({ key }) => key !== 'ly.img.templates'),
{
id: 'ly.img.assetLibrary.dock',
label: 'Cutouts',
key: 'ly.img.assetLibrary.dock',
icon: cutoutAssetEntry?.icon,
entries: ['ly.img.cutout.entry']
}
]);
// Open cutout library panel on startup
cesdk.ui.openPanel('//ly.img.panel/assetLibrary', {
payload: {
entries: ['ly.img.cutout.entry']
}
});

The setComponentOrder method adds a “Cutouts” entry to the dock panel with the plugin’s icon. The openPanel call displays the cutout library immediately when the editor loads, giving users instant access to cutout creation tools.

Troubleshooting#

Cutout Not Visible#

Cutouts render using spot color RGB approximations. Verify the cutout is appended to the page hierarchy and positioned within the visible canvas area.

Printer Not Cutting#

Check that spot color names match your printer’s requirements. Some printers need specific names like CutContour or Thru-cut. Consult your printer documentation.

Combined Cutout Has Wrong Type#

Combined cutouts inherit the type from the first cutout in the array. Reorder the array or set the type explicitly after combination.

API Reference#

MethodCategoryPurpose
cesdk.addPlugin(CutoutLibraryPlugin(config))PluginRegister cutout library plugin
cesdk.ui.getAssetLibraryEntry(id)UIGet asset library entry for dock
cesdk.ui.setComponentOrder({ in: 'ly.img.dock' }, entries)UIConfigure dock panel order
cesdk.ui.openPanel(id, options)UIOpen panel programmatically
engine.block.createCutoutFromPath(path)CutoutCreate cutout from SVG path string
engine.block.createCutoutFromBlocks(ids, vThresh, sThresh, useShape)CutoutCreate cutout from block contours
engine.block.createCutoutFromOperation(ids, op)CutoutCombine cutouts with boolean operation
engine.block.setEnum(id, 'cutout/type', value)PropertySet cutout type (Solid/Dashed)
engine.block.setFloat(id, 'cutout/offset', value)PropertySet cutout offset distance
engine.block.setFloat(id, 'cutout/smoothing', value)PropertySet corner smoothing threshold
engine.block.appendChild(parent, child)HierarchyAdd cutout to scene
engine.block.setPositionX/Y(id, value)TransformPosition cutout on canvas
engine.block.destroy(id)LifecycleRemove cutout from scene
engine.editor.setSpotColorRGB(name, r, g, b)EditorCustomize spot color rendering

Next Steps#

Cutout Type#

A block that defines a cutout path for another block.

This section describes the properties available for the Cutout Type (//ly.img.ubq/cutout) block type.

PropertyTypeDefaultDescription
alwaysOnBottomBoolfalseIf true, this element’s global sorting order is automatically adjusted to be lower than all other siblings.
alwaysOnTopBooltrueIf true, this element’s global sorting order is automatically adjusted to be higher than all other siblings.
clippedBoolfalseThis component is used to identify elements whose contents and children should be clipped to their bounds.
contentFill/modeEnum"Cover"Defines how content should be resized to fit its container (e.g., Crop, Cover, Contain)., Possible values: "Crop", "Cover", "Contain"
cutout/offsetFloat0The offset from path at which to draw the cutout line.
cutout/pathString""The path string, accepts a subset of SVG path strings.
cutout/smoothingFloat0Pixel threshold by which to round out the path’s corners.
cutout/typeEnum"Solid"The type of cutout line., Possible values: "Solid", "Dashed"
flip/horizontalBool"-"Whether the block is flipped horizontally.
flip/verticalBool"-"Whether the block is flipped vertically.
globalBoundingBox/heightFloat"-"The height of the block’s axis-aligned bounding box in world coordinates., (read-only)
globalBoundingBox/widthFloat"-"The width of the block’s axis-aligned bounding box in world coordinates., (read-only)
globalBoundingBox/xFloat"-"The x-coordinate of the block’s axis-aligned bounding box in world coordinates., (read-only)
globalBoundingBox/yFloat"-"The y-coordinate of the block’s axis-aligned bounding box in world coordinates., (read-only)
heightFloat100The height of the block’s frame.
height/modeEnum"Absolute"A mode describing how the height dimension may be interpreted (Absolute, Percent, Auto)., Possible values: "Absolute", "Percent", "Auto"
highlightEnabledBooltrueShow highlighting when selected or hovered
lastFrame/heightFloat"-"The height of the block’s frame from the previous layout pass., (read-only)
lastFrame/widthFloat"-"The width of the block’s frame from the previous layout pass., (read-only)
lastFrame/xFloat"-"The x-coordinate of the block’s frame from the previous layout pass., (read-only)
lastFrame/yFloat"-"The y-coordinate of the block’s frame from the previous layout pass., (read-only)
placeholder/enabledBoolfalseWhether the placeholder behavior is enabled or not.
placeholderControls/showButtonBoolfalseShow the placeholder button.
placeholderControls/showOverlayBoolfalseShow the overlay pattern.
position/xFloat0The x-coordinate of the block’s origin.
position/x/modeEnum"Absolute"A mode describing how the x-position may be interpreted., Possible values: "Absolute", "Percent", "Auto"
position/yFloat0The y-coordinate of the block’s origin.
position/y/modeEnum"Absolute"A mode describing how the y-position may be interpreted., Possible values: "Absolute", "Percent", "Auto"
rotationFloat0The rotation of the block in radians.
selectedBoolfalseIndicates if the block is currently selected.
transformLockedBoolfalseDesignBlocks with this tag can’t be transformed (moved, rotated, scaled, cropped, or flipped).
visibleBooltrueIf the block is visible in the editor.
widthFloat100The width of the block’s frame.
width/modeEnum"Absolute"A mode describing how the width dimension may be interpreted (Absolute, Percent, Auto)., Possible values: "Absolute", "Percent", "Auto"