Dynamic Image API
- 2-3 minutes to read
Dynamic Image is an API intended to generate images by personalizing a Photoshop PSD file. You can replace the content of the layers, for example, by changing the image, text, or shape color, or choosing a visible sub-layer of a group.
There are several use cases for Dynamic Image.
The primary purpose is generating photorealistic preview images by showing a design on a product mockup. They can be used as product images in an online store or even displayed to the end users as preview images of their personalized designs, shown below.
You can just create a Photoshop file representing a blank T-shirt or a pile of business cards and pass an image of your design to a Smart Object on a mockup. In addition to a design, you may change other elements of a mockup: toggle visibility of certain layers, change colors, etc.
Imagine you have a business card design and you need to impose it on a letter-size or tabloid-size sheet.
You may create a PSD file as an imposition template with Smart Objects as placeholders for the design, then add crop marks and other markup and populate this template with your designs.
Print product templates
You may also use Photoshop files as templates for print designs. In most cases, you would prefer using Customer's Canvas designs for this purpose, but sometimes PSD templates are more convenient. For example, if you want to generate a personalized PDF file by replacing a few text elements and insert it as a background to a Customer's Canvas design.
How does it work?
It is very simple. Just create a Photoshop file and upload it to the Dynamic Image. After that, you can make a REST API request where you specify the name of this PSD file and make a command like insert the image from
http://example.com/1.jpg to the layer Photo Placeholder and change the color of the layer Background Rectangle to
#00FF00. It will render this PSD file with the requested changes, save the resulting image inside the application, and return a link to this image. To get this image, you make another REST API request.
You may send the following commands:
- Toggle visibility of layers of any type.
- Replace images in Image Layers. You may refer images from Asset Storage or by URL. You may do simple transforms like rotation or flipping.
- Insert an image into a Smart Object. All the transformations of a Smart Object are applied.
- Replace texts and update font settings.
- Switch a visible layer in a Group Layer.
It is also possible to do nested processing. For example, you may pass another PSD file with personalization to a Smart object, or when you are working with the Group Item, it may contain personalizable elements as well.
Although Dynamic Image does not support 100% of Photoshop features, it allows you to use most of the features required to build impressive and photorealistic mockups: blending modes and opacity, vector masks, and warp transforms of a Smart Object.