The Dynamic Image API

The Dynamic Image API (DI, also known as PsdWebService) is a REST API that allows you to generate images dynamically from a PSD file, where we can replace and modify some layers based on HTTP requests.

DI can be a useful tool in many use cases. For example, you are building an e-commerce system and need to generate a lot of product images for its different variants (like Color, Size, etc). Maybe you need to personalize designs by replacing texts, colors, images, or you need to insert a design on a product mockup.

How does it work?

The overall idea is the following. You create a multilayered PSD file. For example, it may contain a photo as a Photo layer, text string as a Message layer, and a rectangle under this text as a Text Background layer. Now, you want to replace the photo, text, text color, and text background.

You send an HTTP request to DI, where you specify the name of a PSD file and a list of "commands" defining what to do with each of these layers, e.g. insert the URL http://example.com/image.jpg into the Photo layer, or set the Message layer to Hello World and change its text to yellow, while the underlaying rectangle should become blue. The Dynamic Image API performs all these operations and returns a URL to the resulting image or a PDF file.

There are many different commands - in addition to the image replacement, text and font settings modifications, and shape object color changes, you can also insert images to Smart Objects, toggle elements' visibility, or even generate tables! See a full list of features below.

Features

You can use the following image personalization features:

  • Hiding design elements.
  • Replacing images (both local images and by direct URLs).
  • Replacing text and text style (font, size, and color).
  • Inserting images into a smart object.
  • Inserting a PSD file into a smart object, and defining custom parameters for this PSD file.
  • Selecting a layer from a group with predefined parameters.

The Dynamic Image API is implemented as a web service providing basic methods for rendering product images:

Also, this web service provides additional methods to work with an image library and fonts on your server.