Skip to content

Image Item

Renders a raster image on the canvas. Supports filters, borders, corner radius, SVG masks, shadows, and cropping.

Creating an Image Item

tsx
const { addItem } = useStudio()

addItem('Image', {
  x: 0,
  y: 0,
  width: 600,
  height: 400,
  itemProps: {
    src: 'https://example.com/photo.jpg',
  },
})

Properties

All properties below are passed inside itemProps.

Source

PropertyTypeDescription
srcstringURL or data URI of the image. Required.
flipXbooleanFlip the image horizontally.
flipYbooleanFlip the image vertically.

Border

PropertyTypeDescription
borderColorstringBorder color (hex).
borderWidthnumberBorder thickness in pixels.
cornerRadiusnumberCorner radius in pixels.

Filters

PropertyTypeDescription
blurnumberGaussian blur amount.
brightnessnumberBrightness adjustment.
contrastnumberContrast adjustment.
saturationnumberColor saturation.
temperaturenumberColor temperature.
vibrancenumberVibrance adjustment.
shadowsnumberShadow tone adjustment.
whitesnumberWhites tone adjustment.
blacksnumberBlacks tone adjustment.

Shadow

PropertyTypeDescription
shadowEnabledbooleanEnable or disable the shadow.
shadowColorstringShadow color.
shadowBlurnumberShadow blur radius.
shadowOffsetXnumberShadow horizontal offset.
shadowOffsetYnumberShadow vertical offset.

Crop

PropertyTypeDescription
crop{ x: number; y: number; width: number; height: number }Crop region in pixels relative to the original image.

Mask

PropertyTypeDescription
svgMask{ path: string; viewBox: { x: number; y: number; w: number; h: number }; filename: string }SVG shape used as a clip mask.

Full Example

tsx
addItem('Image', {
  x: 50,
  y: 50,
  width: 500,
  height: 350,
  itemProps: {
    src: 'https://example.com/photo.jpg',
    cornerRadius: 16,
    borderColor: '#ffffff',
    borderWidth: 4,
    brightness: 0.1,
    contrast: 0.2,
    shadowEnabled: true,
    shadowColor: '#000000',
    shadowBlur: 20,
    shadowOffsetX: 0,
    shadowOffsetY: 8,
  },
})

Released under a proprietary license.