Non-Destructive Transforms
These transforms are applied during rendering without modifying the layer’s pixel data. UseupdateLayer() to set them.
Transform Properties
X position on canvas
Y position on canvas
Transform anchor point: “topLeft”, “top_left”, “center”, 0, or 1
Flip horizontally
Flip vertically
Rotation in degrees
Horizontal scale factor
Vertical scale factor
setLayerPosition()
Layer ID
X position
Y position
setLayerAnchor()
Layer ID
Transform anchor: “topLeft”, “top_left”, “center”, 0, or 1
setLayerFlip()
Layer ID
Flip horizontally
Flip vertically
setLayerRotation()
Layer ID
Rotation in degrees
Destructive Resize
These methods permanently modify the layer’s pixel data.resizeLayerNearest()
Resize using nearest-neighbor interpolation (ideal for pixel art).Layer ID
New width
New height
resizeLayerBilinear()
Resize using bilinear interpolation (smooth, general purpose).Layer ID
New width
New height
resizeLayerLanczos3()
Resize using Lanczos3 interpolation (highest quality, slower).Layer ID
New width
New height
Crop and Trim
cropLayer()
Crop a layer to a rectangular region.Layer ID
Crop rectangle X
Crop rectangle Y
Crop rectangle width
Crop rectangle height
trimLayerAlpha()
Trim transparent edges from a layer.Layer ID
Destructive Rotation
rotateLayer()
Rotate a layer by an arbitrary angle (permanently modifies pixels).Layer ID
Rotation angle in degrees
For non-destructive rotation, use
updateLayer() with the rotation property instead.