returns SVG.Image which inherits from SVG.Shape

Creating images is as you might expect:

var image = draw.image('/path/to/image.jpg')

If you know the size of the image, those parameters can be passed as the second and third arguments:

var image = draw.image('/path/to/image.jpg', 200, 300)


returns itself

Loading another image can be done with the load() method:



returns itself

If you don't know the size of the image, obviously you will have to wait for the image to be loaded:

var image = draw.image('/path/to/image.jpg').loaded(function(loader) {
  this.size(loader.width, loader.height)

The returned loader object as first the argument of the loaded method contains four values:

  • width
  • height
  • ratio (width / height)
  • url
Fork me on GitHub