Edit in GitHubLog an issue

Smart Objects

With Smart Objects, you can create define objects in an image and adjust these objects in a way that does not alter the underlying object.

Smart Objects and the API

The Smart Object endpoint allows you to create and edit an embedded Smart Objects in a Photoshop file, or PSD file. The Smart Object that's replaced will be positioned within the bounding box of the original image. Whether the new image is larger or smaller than the original, it will adjust to fit within the original bounding box while preserving its aspect ratio. To alter the bounds of the replaced image, you can specify bounds parameters in the API call.

Creating a smartObject

This example shows how you can create an embedded smart object using the /smartObject endpoint.

Copied to your clipboard
curl -X POST \
https://image.adobe.io/pie/psdService/smartObject \
-H "Authorization: Bearer $token" \
-H "x-api-key: $apiKey" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
{
"href": "<SIGNED_GET_URL>",
"storage": "<storage>"
}],
"options": {
"layers": [{
"name": "New",
"add": {
"insertTop": true
},
"input": {
"href": "<SIGNED_GET_URL>",
"storage": "<storage>"
}
}
]
},
"outputs": [
{
"storage": "<storage>",
"href": "<SIGNED_POST_URL>",
"type": "vnd.adobe.photoshop"
}
]}'

A call to this API initiates an asynchronous job and returns a response containing an href. Use the value in the href to poll for the status of the job. This is illustrated in Example, Fetch API Status and Example, Poll Job Status.

Known Limitations

  • If your document contains transparent pixels, (e.g some .png), you may not get consistent bounds.
  • We currently do not support Linked Smart Objects.
  • In order to update an embedded Smart Object that is referenced by multiple layers you need to update each of those layers in order for the Smart Object to be replaced in those layers.

Here is an example of replacing a Smart Object within a layer:

Copied to your clipboard
curl -X POST \
https://image.adobe.io/pie/psdService/smartObject \
-H "Authorization: Bearer $token" \
-H "x-api-key: $apiKey" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
{
"href": "<SIGNED_GET_URL>",
"storage": "<storage>"
}],
"options": {
"layers": [{
"name": "HeroImage",
"input": {
"href": "<SIGNED_GET_URL>",
"storage": "<storage>"
}
}
]
},
"outputs": [
{
"storage": "<storage>",
"href": "<SIGNED_POST_URL>",
"type": "vnd.adobe.photoshop"
}
]}'

For better performance, we rasterize our smart objects that are bigger than 2000 pixels * 2000 pixels. For optimal processing, please make sure the embedded smart object that you want to replace only contains alphanumeric characters in it's name.

In this example, we generated a Smart Object within the "socks" layer and utilized the API to substitute the original image with a new pattern. This process facilitated the creation of two variations of the identical photograph. alt image

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.