Skip to main content
Skip table of contents

Canvas and layers

All Image Server rendering operations apply to a current canvas. At any time, there can be a number of canvases in progress:

  • Main canvas

  • Grouped layers

By default, the rendering process starts with a blank canvas that has no defined dimensions. Some rendering operations require a proper “underlayer” and thus may trigger an error in this blank state. For example, text rendering requires a background or at least a well-defined image dimensions.

Canvas Dimensions

Canvas dimensions can be specified in two ways:

  • Explicitly using wid and hei options

  • Implicitly by adopting the dimensions of the first layer, if that layer generates a raster image.

Layers

Each rendering operation applies not to a specific canvas, but also to a layer. There can be only one active layer at a time, and it is not possible to “go back” to a previous layer to make some modifications; once a new layer is started, all operations will apply to that layer.

Each layer can be thought as a single image or a text component that contributes to the overall picture. A mockup with a background and foreground picture would consist of multiple layers and a single canvas:

https://api.images.drivecommerce.com/api/v1/drive/image/?wid=2000&hei=1650&layer=0&src=coffee-background&layer=1&src=coffee-shadow&layer=2&src=coffee

Layers that contribute to the overall picture:

Background

Shadow

Foreground

Resulting Picture

  • We started by defining the image dimensions using wid and hei commands

  • Then, added a layer of coffee-background image

  • Then, a layer of coffee-shadow image

  • And finally coffee image

Defining a layer

A new layer is started by using l or layer command. The command parameter can be used to indicate a layer number, however this parameter value is generally ignored.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.