Edit in GitHubLog an issue

Sample Code

Photoshop

The code snippets are using one of our sample psd files. Please feel free to download and use it for testing. Just remember you will need to have this file stored in one of the accepted external storages. For more information on storage please refer to the File Storage.

For each of these examples to run. You first have to get your Bearer token and apikey. For ease of use, you can export your token and api key before running the examples.

Copied to your clipboard
export token="<YOUR_TOKEN>"
Copied to your clipboard
export apiKey="<YOUR_API_KEY>"

Executing an actionJSON

The /actionJSON endpoint can take an input file and apply any Photoshop Action file on it and edit the steps within the original action file. This gives you a lot of flexibility to create dynamic changes to an otherwise static Action file. In this example we are going to use a familiar asset and action file and we are going to modify the payload to return an output that executes all of the steps of the original action with one modification, instead of color we are going to use actionJSON to return a black and white image. This action file contains over 70 steps so we wont show the entire JSON payload but will share the part we modified to achieve the output.

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/actionJSON \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [{
8 "href": "<SIGNED_GET_URL>",
9 "storage": "<storage>"
10 }],
11 "options": {
12 "actionJSON": [{
13 "_obj": "imageSize",
14 "constrainProportions": true,
15 "interfaceIconFrameDimmed": {
16 "_enum": "interpolationType",
17 "_value": "automaticInterpolation"
18 },
19 "scaleStyles": true
20 }, {
21 "_obj": "imageSize",
22 "constrainProportions": true,
23 "interfaceIconFrameDimmed": {
24 "_enum": "interpolationType",
25 "_value": "automaticInterpolation"
26 },
27 "resolution": {
28 "_unit": "densityUnit",
29 "_value": 72.0
30 },
31 "scaleStyles": true
32 },
33 {
34 "_obj": "make",
35 "_target": [{
36 "_ref": "adjustmentLayer"
37 }],
38 "using": {
39 "_obj": "adjustmentLayer",
40 "type": {
41 "_obj": "blackAndWhite",
42 "blue": 20,
43 "cyan": 60,
44 "grain": 40,
45 "magenta": 80,
46 "presetKind": {
47 "_enum": "presetKindType",
48 "_value": "presetKindDefault"
49 },
50 "red": 40,
51 "tintColor": {
52 "_obj": "RGBColor",
53 "blue": 179.00115966796876,
54 "grain": 211.00067138671876,
55 "red": 225.00045776367188
56 },
57 "useTint": false,
58 "yellow": 60
59 }
60 }
61 }
62 ]
63 },
64 "outputs": [{
65 "type": "image/jpeg",
66 "storage": "<storage>",
67 "href": "<SIGNED_POST_URL>"
68 }]
69}'

Executing an actionJSON with multiple inputs

With /actionJSON endpoint you can use multiple images to do compositing on the actionJSON.

In order to supply multiple images and have it specified in the actionJSON, you need to create a Placeholder Value in your actionJSON. The placeholder value must be "ACTION_JSON_OPTIONS_ADDITIONAL_IMAGES_X" where "X" is the index of the "additionalImages" array.

For example, say you have an actionJSON that requires 2 additional Images.

ACTION_JSON_OPTIONS_ADDITIONAL_IMAGES_0 == options.additionalImages[0] ACTION_JSON_OPTIONS_ADDITIONAL_IMAGES_1 == options.additionalImages[1]

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/actionJSON \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }
12 ],
13 "options": {
14 "additionalImages": [
15 {
16 "href": "<SIGNED_GET_URL>",
17 "storage": "<storage>"
18 }
19 ],
20 "actionJSON": [
21 {
22 "ID": 3,
23 "_obj": "placeEvent",
24 "freeTransformCenterState": {
25 "_enum": "quadCenterState",
26 "_value": "QCSAverage"
27 },
28 "null": {
29 "_kind": "local",
30 "_path": "ACTION_JSON_OPTIONS_ADDITIONAL_IMAGES_0"
31 },
32 "offset": {
33 "_obj": "offset",
34 "horizontal": {
35 "_unit": "pixelsUnit",
36 "_value": 0
37 },
38 "vertical": {
39 "_unit": "pixelsUnit",
40 "_value": 0
41 }
42 }
43 },
44 {
45 "_obj": "autoCutout",
46 "sampleAllLayers": false
47 },
48 {
49 "_obj": "make",
50 "at": {
51 "_enum": "channel",
52 "_ref": "channel",
53 "_value": "mask"
54 },
55 "new": {
56 "_class": "channel"
57 },
58 "using": {
59 "_enum": "userMaskEnabled",
60 "_value": "revealSelection"
61 }
62 },
63 {
64 "_obj": "set",
65 "_target": [
66 {
67 "_property": "selection",
68 "_ref": "channel"
69 }
70 ],
71 "to": {
72 "_enum": "ordinal",
73 "_value": "allEnum"
74 }
75 },
76 {
77 "_obj": "align",
78 "_target": [
79 {
80 "_enum": "ordinal",
81 "_ref": "layer"
82 }
83 ],
84 "alignToCanvas": false,
85 "using": {
86 "_enum": "alignDistributeSelector",
87 "_value": "ADSBottoms"
88 }
89 },
90 {
91 "_obj": "align",
92 "_target": [
93 {
94 "_enum": "ordinal",
95 "_ref": "layer"
96 }
97 ],
98 "alignToCanvas": false,
99 "using": {
100 "_enum": "alignDistributeSelector",
101 "_value": "ADSRights"
102 }
103 },
104 {
105 "_obj": "set",
106 "_target": [
107 {
108 "_property": "selection",
109 "_ref": "channel"
110 }
111 ],
112 "to": {
113 "_enum": "ordinal",
114 "_value": "none"
115 }
116 }
117 ]
118
119 },
120 "outputs": [
121 {
122 "type": "image/jpeg",
123 "href": "<SIGNED_PUT_URL>",
124 "storage": "<storage>"
125 }
126 ]
127}'

Replacing a smartObject

The /smartObject endpoint can take an input PSD file with an embedded smartObject and can replace with another smartObject. This API is a simple API developed to ease the smartObject replacement workflow for an user.

This example shows how you can replace an embedded smart object. Sample Code

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/smartObject \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }],
12 "options": {
13 "layers": [{
14 "name": "HeroImage",
15 "input": {
16 "href": "<SIGNED_GET_URL>",
17 "storage": "<storage>"
18 }
19 }
20 ]
21 },
22 "outputs": [
23 {
24 "storage": "<storage>",
25 "href": "<SIGNED_POST_URL>",
26 "type": "vnd.adobe.photoshop"
27 }
28]}'

Creating a smartObject

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

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/smartObject \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }],
12 "options": {
13 "layers": [{
14 "name": "New",
15 "add": {
16 "insertTop": true
17 },
18 "input": {
19 "href": "<SIGNED_GET_URL>",
20 "storage": "<storage>"
21 }
22 }
23 ]
24 },
25 "outputs": [
26 {
27 "storage": "<storage>",
28 "href": "<SIGNED_POST_URL>",
29 "type": "vnd.adobe.photoshop"
30 }
31]}'

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 12 and Example 14

Making a text layer edit

This example shows how you can edit a text layer using the /text endpoint. Sample Code

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/text \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "layers":[
15 {
16 "name": "My Text Layer",
17 "text": {
18 "content": "CHANGED TO NEW TEXT",
19 "orientation": "horizontal",
20 "characterStyles": [{
21 "size": 15,
22 "orientation": "horizontal",
23 "color": {
24 "red":255,
25 "green":0,
26 "blue":0
27 }
28 }],
29 "paragraphStyles": [{
30 "alignment": "right"
31 }]
32 }
33 }
34 ]
35 },
36 "outputs":[
37 {
38 "href":"<SIGNED_POST_URL>",
39 "storage":"<storage>",
40 "type":"vnd.adobe.photoshop"
41 }
42 ]
43}'

Custom font in a text layer

This will change the font in a text layer named My Text Layer to a custom font VeganStylePersonalUse. Note: the value for the fontName field in the text.characterStyles section is the full postscript name of the custom font.

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/text \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "fonts": [
15 {
16 "storage": "<storage>",
17 "href": "<SIGNED_GET_URL_TO_VeganStylePersonalUse.ttf>"
18 }
19 ],
20 "layers":[
21 {
22 "name": "My Text Layer",
23 "text": {
24 "content": "CHANGED TO NEW TEXT",
25 "orientation": "horizontal",
26 "characterStyles": [{
27 "size": 15,
28 "orientation": "horizontal",
29 "color": {
30 "red":255,
31 "green":0,
32 "blue":0
33 }
34 }],
35 "paragraphStyles": [{
36 "alignment": "right"
37 }]
38 }
39 }
40 ]
41 },
42 "outputs":[
43 {
44 "href":"<SIGNED_POST_URL>",
45 "storage":"<storage>",
46 "type":"vnd.adobe.photoshop"
47 }
48 ]
49}'

Dictating actions for missing fonts

In this request for example, if MySampleFont is not found while processing the request, the system default font (ArialMT) will be used as manageMissingFonts is set to useDefault

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/text \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "manageMissingFonts": "useDefault",
15 "globalFont": "MySampleFont",
16 "fonts": [
17 {
18 "storage": "<storage>",
19 "href": "<SIGNED_GET_URL_TO_VeganStylePersonalUse.ttf>"
20 }
21 ],
22 "layers":[
23 {
24 "name": "My Text Layer",
25 "text": {
26 "content": "CHANGED TO NEW TEXT",
27 "orientation": "horizontal",
28 "characterStyles": [{
29 "size": 15,
30 "orientation": "horizontal",
31 "color": {
32 "red":255,
33 "green":0,
34 "blue":0
35 }
36 }],
37 "paragraphStyles": [{
38 "alignment": "right"
39 }]
40 }
41 }
42 ]
43 },
44 "outputs":[
45 {
46 "href":"<SIGNED_POST_URL>",
47 "storage":"<storage>",
48 "type":"vnd.adobe.photoshop"
49 }
50 ]
51}'

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 12 and Example 14

Making a simple edit

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/documentOperations \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "layers":[
15 {
16 "edit":{},
17 "id":750,
18 "index":1,
19 "locked":true,
20 "name":"HeroImage",
21 "type":"smartObject",
22 "visible":true
23 }
24 ]
25 },
26 "outputs":[
27 {
28 "href":"<SIGNED_POST_URL>",
29 "storage":"<storage>",
30 "type":"vnd.adobe.photoshop"
31 }
32 ]
33}'

Swapping the image in a smart object layer

In this example we are replacing the smartObject using documentOperations API

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/documentOperations \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "layers":[
15 {
16 "edit":{},
17 "input":{
18 "href":"<SIGNED_GET_URL>",
19 "storage":"<storage>"
20 },
21 "smartObject" : {
22 "type" : "image/png"
23 },
24 "attributes":{
25 "bounds":{
26 "height":515,
27 "left":-385,
28 "top":-21,
29 "width":929
30 }
31 },
32 "id":750,
33 "index":1,
34 "locked":false,
35 "name":"HeroImage",
36 "type":"smartObject",
37 "visible":true
38 }
39 ]
40 },
41 "outputs":[
42 {
43 "href":"<SIGNED_POST_URL>",
44 "storage":"<storage>",
45 "type":"vnd.adobe.photoshop"
46 }
47 ]
48}'

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 12 and Example 14

Adding a new adjustment layer

This example shows how you can add a new brightnessContrast adjustment layer to the top of your PSD.

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/documentOperations \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "layers":[
15 {
16 "add":{
17 "insertAbove": {
18 "id": 549
19 }
20 },
21 "adjustments":{
22 "brightnessContrast":{
23 "brightness":25,
24 "contrast":-40
25 }
26 },
27 "name":"NewBrightnessContrast",
28 "type":"adjustmentLayer"
29 }
30 ]
31 },
32 "outputs":[
33 {
34 "href":"<SIGNED_POST_URL>",
35 "storage":"<storage>",
36 "type":"image/jpeg"
37 }
38 ]
39}'

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 12 and Example 14

Editing a pixel layer

In this example we want to replace the image in an existing pixel layer, the Hero Image layer in Example.psd.

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/documentOperations \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "options":{
14 "layers":[
15 {
16 "edit":{},
17 "input":{
18 "href":"<SIGNED_GET_URL>",
19 "storage":"<storage>"
20 },
21 "bounds":{
22 "height":405,
23 "left":0,
24 "top":237,
25 "width":300
26 },
27 "id":751,
28 "index":2,
29 "locked":false,
30 "name":"BackgroundGradient",
31 "type":"layer",
32 "visible":true
33 }
34 ]
35 },
36 "outputs":[
37 {
38 "href":"<SIGNED_POST_URL>",
39 "storage":"<storage>",
40 "type":"vnd.adobe.photoshop"
41 }
42 ]
43}
44'

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 12 and Example 14

Create a document rendition

Generate multiple output renditions with the API renditionCreate

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/renditionCreate \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs":[
8 {
9 "href":"<SIGNED_GET_URL>",
10 "storage":"<storage>"
11 }
12 ],
13 "outputs":[
14 {
15 "href":"<SIGNED_POST_URL1>",
16 "width": 512,
17 "storage":"<storage>",
18 "type":"image/jpeg"
19 },
20 {
21 "href":"<SIGNED_POST_URL2>",
22 "storage":"<storage>",
23 "type":"image/png"
24 }
25 ]
26}'

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 12 and Example 14

Retrieve a PSD's JSON manifest

The /documentManifest api can take one input PSD's to generate a JSON manifest file. The JSON manifest is the tree representation of all of the layer objects contained in the PSD document.

Using Example.psd, with the use case of a document stored in your external storage (ie. azure, aws, dropbox), a typical curl call might look like this:

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/documentManifest \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href":"<YOUR_PRESIGNED_URL>",
10 "storage":"<storage>"
11 }
12 ]
13}'

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 and the same response will also contain the JSON manifest. This is illustrated in Example 12 and Example 14

Fetch the status of an API

Each of our Photoshop APIs, when invoked, initiates an asynchronous job and returns a response body that contains the href to poll for status of the job.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/pie/psdService/status/de2415fb-82c6-47fc-b102-04ad651c5ed4"
5 }
6 }
7}

Using the job id returned from the response (ass above) of a successfully submitted API call, you can poll on the corresponding value in the href field, to get the status of the job.

Copied to your clipboard
1curl -X GET \
2 https://image.adobe.io/pie/psdService/status/de2415fb-82c6-47fc-b102-04ad651c5ed4 \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json"

Poll for job status for documentManifest

Once your job completes successfully (no errors/failures reported), the status response will contain your document's JSON manifest along with other metadata about the input document. The JSON Manifest is further described in the api docs

Copied to your clipboard
1{
2 "jobId":"63c6e812-6cb8-43de-8a60-3681a9ec6feb",
3 "outputs":[
4 {
5 "input":"<SIGNED_GET_URL>",
6 "status":"succeeded",
7 "created":"2018-08-24T23:07:36.8Z",
8 "modified":"2018-08-24T23:07:37.688Z",
9 "layers":[
10 {
11 "bounds":{
12 "height":64,
13 "left":12,
14 "top":1,
15 "width":39
16 },
17 "id":549,
18 "index":8,
19 "locked":false,
20 "name":"CompanyLogo",
21 "type":"smartObject",
22 "visible":true
23 },
24 {
25 "bounds":{
26 "height":153,
27 "left":31,
28 "top":334,
29 "width":197
30 },
31 "children":[
32 {
33 "bounds":{
34 "height":136,
35 "left":29,
36 "top":326,
37 "width":252
38 },
39 "text": {
40 "content":"Reset your customers’ expectations.",
41 "paragraphStyles":[
42 {
43 "alignment":"left"
44 }
45 ],
46 "characterStyles":[{
47 "fontAvailable":true,
48 "fontName":"AdobeClean-Bold",
49 "fontSize":36,
50 "orientation":"horizontal"
51 }]
52 },
53 "id":412,
54 "index":6,
55 "locked":false,
56 "name":"Reset your customers’ expectations.",
57 "type":"textLayer",
58 "visible":true
59 },
60 {
61 "bounds":{
62 "height":67,
63 "left":30,
64 "top":452,
65 "width":230
66 },
67 "text":{
68 "content":"Get our retail experience article and infographic.",
69 "paragraphStyles":[{
70 "alignment":"left"
71 }],
72 "characterStyles":[{
73 "fontAvailable":true,
74 "fontName":"AdobeClean-Regular",
75 "fontSize":15,
76 "orientation":"horizontal"
77 }]
78 },
79 "id":676,
80 "index":5,
81 "locked":false,
82 "name":"Get our retail experience article and infographic.",
83 "type":"textLayer",
84 "visible":true
85 }
86 ],
87 "id":453,
88 "index":7,
89 "locked":false,
90 "name":"Headline",
91 "type":"layerSection",
92 "visible":true
93 },
94 {
95 "bounds":{
96 "height":34,
97 "left":31,
98 "top":508,
99 "width":99
100 },
101 "id":762,
102 "index":3,
103 "locked":false,
104 "name":"CallToAction",
105 "type":"smartObject",
106 "visible":true
107 },
108 {
109 "bounds":{
110 "height":405,
111 "left":0,
112 "top":237,
113 "width":300
114 },
115 "id":751,
116 "index":2,
117 "locked":false,
118 "name":"BackgroundGradient",
119 "type":"layer",
120 "visible":true
121 },
122 {
123 "bounds":{
124 "height":515,
125 "left":-385,
126 "top":-21,
127 "width":929
128 },
129 "id":750,
130 "index":1,
131 "locked":false,
132 "name":"HeroImage",
133 "type":"smartObject",
134 "visible":true
135 },
136 {
137 "bounds":{
138 "height":600,
139 "left":0,
140 "top":0,
141 "width":300
142 },
143 "id":557,
144 "index":0,
145 "locked":false,
146 "name":"Background",
147 "type":"layer",
148 "visible":true
149 }
150 ],
151 "document":{
152 "height":600,
153 "name":"Example.psd",
154 "width":300
155 }
156 }
157 ],
158 "_links":{
159 "self":{
160 "href":"https://image.adobe.io/pie/psdService/status/8ec6e4f5-b580-41ac-b693-a72f150fec59"
161 }
162 }
163}

Poll for job status for all Other APIs

Once your job completes successfully (no errors/failures reported), this will return a response body containing the job status for each requested output. For the /renditionCreate API call in Example 10 as illustrated above, a sample response containing the job status is as shown below:

Copied to your clipboard
1{
2 "jobId":"de2415fb-82c6-47fc-b102-04ad651c5ed4",
3 "outputs":[
4 {
5 "input":"<SIGNED_GET_URL>",
6 "status":"succeeded",
7 "created":"2018-01-04T12:57:15.12345:Z",
8 "modified":"2018-01-04T12:58:36.12345:Z",
9 "_links":{
10 "renditions":[
11 {
12 "href":"<SIGNED_GET_URL>",
13 "width": 512,
14 "storage":"<storage>",
15 "type":"image/jpeg"
16 },
17 {
18 "href":"<SIGNED_GET_URL>",
19 "storage":"<storage>",
20 "type":"image/png"
21 }
22 ]
23 }
24 }
25 ],
26 "_links":{
27 "self":{
28 "href":"https://image.adobe.io/pie/psdService/status/de2415fb-82c6-47fc-b102-04ad651c5ed4"
29 }
30 }
31}

Photoshop Actions - Play ALL actions in .atn file.

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/photoshopActions \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "https://as2.ftcdn.net/jpg/02/49/48/49/500_F_249484911_JifPIzjUqzkRhcdMkF9GnsUI9zaqdAsn.jpg",
10 "storage": "external"
11 }
12 ],
13 "options": {
14 "actions": [
15 {
16 "href": "https://raw.githubusercontent.com/johnleetran/ps-actions-samples/master/actions/Oil-paint.atn",
17 "storage": "external"
18 }
19 ]
20 },
21 "outputs": [
22 {
23 "storage": "<storage>",
24 "type": "image/jpeg",
25 "href": "https://some-presigned-url/output.jpeg"
26 }
27 ]
28}'

Photoshop Actions Play a specific action

By default, Photoshop API will attempt to play all actions in an action set. If you would like to only playback a specific action, you can specify actionName and the name of the action you want to invoke (see example below).

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/photoshopActions \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "https://as2.ftcdn.net/jpg/02/49/48/49/500_F_249484911_JifPIzjUqzkRhcdMkF9GnsUI9zaqdAsn.jpg",
10 "storage": "external"
11 }
12 ],
13 "options": {
14 "actions": [
15 {
16 "href": "https://raw.githubusercontent.com/johnleetran/ps-actions-samples/master/actions/Oil-paint.atn",
17 "storage": "external",
18 "actionName": "Action 51"
19 }
20 ]
21 },
22 "outputs": [
23 {
24 "storage": "<storage>",
25 "type": "image/jpeg",
26 "href": "https://some-presigned-url/output.jpeg"
27 }
28 ]
29}'

Edit Text Layers

The /text endpoint can take an input PSD file with one or more text layers and can apply edits to it.

This example shows how you can apply edits to two text layers

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/text \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }
12 ],
13 "options": {
14 "fonts": [
15 {
16 "storage": "<storage>",
17 "href": "<SIGNED_GET_URL>"
18 }
19 ],
20 "layers": [
21 {
22 "name": "<name_of_text_layer_1_to_edit>",
23 "text": {
24 "orientation": "horizontal",
25 "contents": "New text Contents 1",
26 "antiAlias": "antiAliasSharp",
27 "characterStyles": [{
28 "autoKern": "metricsKern",
29 "fontPostScriptName": "<font_postscript_name>",
30 "fontCaps": "allCaps",
31 "size": 25,
32 "leading": 20,
33 "tracking": 20,
34 "syntheticBold": true,
35 "ligature": true,
36 "syntheticItalic": true,
37 "color": {
38 "blue": 100,
39 "green": 200,
40 "red": 163
41 }
42 }],
43 "paragraphStyles": [{
44 "align": "right"
45 }]
46 }
47 },
48 {
49 "name": "<name_of_text_layer_2_to_edit>",
50 "text": {
51 "contents": "New text Contents 2",
52 "characterStyles": [{
53 "size": 45,
54 "stylisticAlternates": true,
55 "leading": 100,
56 "tracking": 100,
57 "baseline": "subScript",
58 "strikethrough": true,
59 "underline": true,
60 "verticalScale": 150,
61 "horizontalScale": 200,
62 "color": {
63 "blue": 300,
64 "green": 100,
65 "red": 63
66 }
67 }]
68 }
69 }
70 ]
71 },
72 "outputs": [
73 {
74 "href": "<SIGNED_POST_URL>",
75 "type": "vnd.adobe.photoshop",
76 "storage": "<storage>"
77 }
78 ]
79}'

Applying Product Crop

The productCrop endpoint can take an input file and apply right crop to it. We don't support multilayered PSD.

This example shows how you can apply the crop with required padding to an input file

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/productCrop \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }
12 ],
13 "options": {
14 {
15 "unit": "Pixels",
16 "width": 10,
17 "height": 10
18 }
19 },
20 "outputs": [
21 {
22 "storage": "<storage>",
23 "type": "image/jpeg",
24 "href": "<SIGNED_POST_URL>"
25 }
26 ]
27}'

Applying Depth Blur Neural Filter

The depthBlur endpoint can take an input file and apply the depth blur neural filter.

This example shows how you can apply depth blur with the appropriate parameters.

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/depthBlur \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": [
8 {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }
12 ],
13 "options": {
14 "haze": 25,
15 "blurStrength": 30,
16 "focalSelector": {
17 "x": 0.22,
18 "y": 0.33
19 }
20 },
21 "outputs": [
22 {
23 "storage": "<storage>",
24 "type": "image/jpeg",
25 "href": "<SIGNED_POST_URL>"
26 }
27 ]
28}'

First be sure to follow the instructions in the Authentication section to get your token.

Remove Background

The /cutout api takes a single input image to generate your mask or remove background from. Using Example.jpg, a typical curl call might look like this:

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/sensei/cutout \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "input":{
8 "storage":"<storage>",
9 "href":"<SIGNED_GET_URL>"
10 },
11 "output":{
12 "storage":"<storage>",
13 "href":"<SIGNED_POST_URL>",
14 "mask":{
15 "format":"soft"
16 }
17 }
18}'

This initiates an asynchronous job and returns a response containing the href to poll for job status and the JSON manifest.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/sensei/status/e3a13d81-a462-4b71-9964-28b2ef34aca7"
5 }
6 }
7}

Using the job id returned from the previous call you can poll on the returned /status href to get the job status

Copied to your clipboard
1curl -X GET \
2 https://image.adobe.io/sensei/status/e3a13d81-a462-4b71-9964-28b2ef34aca7 \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json"

Once the job is complete your successful /status response will look similar to the response below; The output will have been placed in your requested location. In the event of failure the errors will be shown instead

Copied to your clipboard
1{
2 "jobID": "e3a13d81-a462-4b71-9964-28b2ef34aca7",
3 "status": "succeeded",
4 "created": "2020-02-11T21:08:43.789Z",
5 "modified": "2020-02-11T21:08:48.492Z",
6 "input": "<SIGNED_GET_URL>",
7 "_links": {
8 "self": {
9 "href": "https://image.adobe.io/sensei/status/e3a13d81-a462-4b71-9964-28b2ef34aca7"
10 }
11 },
12 "output": {
13 "storage": "<storage>",
14 "href": "<SIGNED_POST_URL>",
15 "mask": {
16 "format": "soft"
17 }
18 }
19}

Generate image mask

The workflow is exactly the same as creating Remove Background except you use the /mask endpoint instead of /cutout.

Lightroom

Autotone an image

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/lrService/autoTone \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": {
8 "href": "<SIGNED_GET_URL>",
9 "storage": "<storage>"
10 },
11 "outputs": [
12 {
13 "href": "<SIGNED_POST_URL>",
14 "type": "<type>",
15 "storage": "<storage>"
16 }
17 ]
18}'

This initiates an asynchronous job and returns a request body containing the href to poll for job status.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/lrService/status/<:jobId>"
5 }
6 }
7}

To check the status of the job completion, use the /status API. An example usage of the API can be found here.

Autostraighten an image

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/lrService/autoStraighten \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": {
8 "href": "<SIGNED_GET_URL>",
9 "storage": "<storage>"
10 },
11 "outputs": [
12 {
13 "href": "<SIGNED_POST_URL>",
14 "type": "<type>",
15 "storage": "<storage>"
16 }
17 ]
18}'

This initiates an asynchronous job and returns a request body containing the href to poll for job status.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/lrService/status/<:jobId>"
5 }
6 }
7}

To check the status of the job completion, use the /status API. An example usage of the API can be found here.

Apply presets to an image

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/lrService/presets \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": {
8 "source": {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 },
12 "presets": [
13 {
14 "href": "<SIGNED_GET_URL>",
15 "storage": "<storage>"
16 },
17 {
18 "href": "<SIGNED_GET_URL>",
19 "storage": "<storage>"
20 }
21 ]
22 },
23 "outputs": [
24 {
25 "href": "<SIGNED_POST_URL>",
26 "type": "<type>",
27 "storage": "<storage>"
28 }
29 ]
30}'

This initiates an asynchronous job and returns a request body containing the href to poll for job status.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/lrService/status/<:jobId>"
5 }
6 }
7}

To check the status of the job completion, use the /status API. An example usage of the API can be found here.

Apply edits to an image

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/lrService/edit \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": {
8 "source": {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 }
12 },
13 "options": {
14 "Exposure": -5.00 to 5.00,
15 "Contrast": -100 to 100,
16 "Sharpness": 0 10 150,
17 "WhiteBalance": <"As Shot", "Auto", "Cloudy", "Custom", "Daylight", "Flash", "Fluorescent", "Shade", "Tungsten">
18 "Saturation": -100 to 100,
19 "ColorNoiseReduction": 0 to 100,
20 "NoiseReduction": 0 to 100,
21 "VignetteAmount": -100 to 100,
22 "Vibrance": -100 to 100,
23 "Highlights": -100 to 100,
24 "Shadows": -100 to 100,
25 "Whites": -100 to 100,
26 "Blacks": -100 to 100,
27 "Clarity": -100 to 100,
28 "Dehaze": -100 to +100,
29 "SharpenRadius": 0.5 to 3.0,
30 "SharpenDetail": 0 to 100,
31 "SharpenEdgeMasking": 0 to 100,
32 "Texture": -100 t0 100
33 },
34 "outputs": [
35 {
36 "href": "<SIGNED_POST_URL>",
37 "type": "<type>",
38 "storage": "<storage>"
39 }
40 ]
41}'

This initiates an asynchronous job and returns a request body containing the href to poll for job status.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/lrService/status/<:jobId>"
5 }
6 }
7}

To check the status of the job completion, use the /status API. An example usage of the API can be found here.

Apply xmp to an image

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/lrService/xmp \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "inputs": {
8 "href": "<SIGNED_GET_URL>",
9 "storage": "<storage>"
10 },
11 "options": {
12 "xmp": "<xmp>",
13 "orientation": "<orientation>"
14 },
15 "outputs": [
16 {
17 "href": "<SIGNED_POST_URL>",
18 "storage": "<storage>",
19 "type": "<type>"
20 }
21 ]
22}'

This initiates an asynchronous job and returns a request body containing the href to poll for job status.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/lrService/status/<:jobId>"
5 }
6 }
7}

To check the status of the job completion, use the /status API. An example usage of the API can be found here.

Poll for status and results

Use the JobID to poll on the href that is returned in the response from one of the Lightroom APIs.

  1. Upon successful job completion, the output file will be available at the specified output href.
  2. If the job failed due to an error, the errorDetails field in the response will contain the details of the failure.
Copied to your clipboard
1curl -X GET \
2 https://image.adobe.io/lrService/status/<jobId> \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \

And this will return a request body containing the job status for each requested output and eventually either errors or the hrefs to the requested outputs

Copied to your clipboard
1{
2 "jobId":"<jobId>",
3 "created":"2018-01-04T12:57:15.12345:Z",
4 "modified":"2018-01-04T12:58:36.12345:Z",
5 "outputs":[
6 {
7 "input":"<input_file_href>",
8 "status":"succeeded",
9 "_links":{
10 "self":
11 {
12 "href":"<output_file_href>",
13 "storage":"<storage>"
14 }
15 }
16 }
17 ],
18 "_links":{
19 "self":{
20 "href":"https://image.adobe.io/lrService/status/<jobId>"
21 }
22 }
23}

Customized Workflow

Generate Remove Background result as Photoshop path

This workflow is ONLY for users who'd like to generate remove background result as Photoshop path instead of regular mask or remove background in above example 1 and example 2. You will need to chain API calls to Remove Background service and Photoshop Service to achieve this goal.

Sample Input/Output

Sample input from here. Sample output from here (Note: you will need to open result in Photoshop Desktop application so that you will see the path in path panel)

Instructions

  1. Download the make-file.atn file from here (this file will be used in the Photoshop action API call)
  2. Make the first API call to Remove Background service to generate intermediate result as RGBA remove background
  3. Make the second API call to Photoshop action service to use above intermediate result as well as the make-file.atn file to generate final JPEG format result with desired PS path embedded
  4. Open the final result with Photoshop Desktop app to check generated path in path panel

Sample Code

You can download the sample end-to-end bash script here and then follow the comments to try it out this customized workflow.

Triggering an Event from the API's

In order to start receiving the events in your Webhook Application, the additional thing that needs to be done is to pass in your IMS ORG ID in a header: x-gw-ims-org-id: <YOUR_IMS_ORG_ID>, when you make an API call to initiate a job. Please have a look at the examples below that demonstrates the usage of the new header and a sample event received for that job.

Example 1: Retrieving a PSD manifest from the Photoshop API

Step 1: Initiate a job to retrieve a PSD's JSON manifest

The /documentManifest api can take one or more input PSD's to generate JSON manifest files from. The JSON manifest is the tree representation of all of the layer objects contained in the PSD document. Using Example.psd, with the use case of a document stored in your external storage, a typical curl call might look like this:

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/pie/psdService/documentManifest \
3 -H "Authorization: Bearer $token" \
4 -H "x-api-key: $apiKey" \
5 -H "Content-Type: application/json" \
6 -H 'x-gw-ims-org-id: <YOUR_IMS_ORG_ID>' \
7 -d '{
8 "inputs": [
9 {
10 "href":"<SIGNED_GET_URL>",
11 "storage":"<storage>"
12 }
13 ]
14}'

This initiates an asynchronous job and returns a response containing the href to poll for job status and the JSON manifest.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/pie/psdService/status/63c6e812-6cb8-43de-8a60-3681a9ec6feb"
5 }
6 }
7}

Step 2: Receive the Job's status on the Webhook application when the job is complete

The value in the key body inside the event JSON contains the result of the job. Here is a sample event received from the job initiated above:

Copied to your clipboard
1{
2 "event_id": "b412a90e-8bc0-4f0d-931e-9e9b8d24993d",
3 "event": {
4 "header": {
5 "msgType": "JOB_COMPLETION_STATUS",
6 "msgId": "8afa1a46-2733-406c-a646-e1c1acdee333",
7 "imsOrgId": "<YOUR_IMS_ORG_ID>",
8 "eventCode": "photoshop-job-status",
9 "_pipelineMeta": {
10 "pipelineMessageId": "1586288145511:631472:VA7_A1:142:0"
11 },
12 "_smarts": {
13 "definitionId": "3ee6c9056a9d72fc40e09ddf5fdbb0af752e8e49",
14 "runningSmartId": "psmart-yw6wosjksniuuathenny"
15 },
16 "_adobeio": {
17 "imsOrgId": "<YOUR_IMS_ORG_ID>",
18 "providerMetadata": "di_event_code",
19 "eventCode": "photoshop-job-status"
20 }
21 },
22 "body": {
23 "jobId": "63c6e812-6cb8-43de-8a60-3681a9ec6feb",
24 "outputs": [
25 {
26 "status": "succeeded",
27 "layers": [
28 {
29 "id": 2,
30 "index": 0,
31 "type": "layer",
32 "name": "Layer",
33 "locked": false,
34 "visible": true,
35 "bounds": {
36 "top": 0,
37 "left": 0,
38 "width": 100,
39 "height": 100
40 },
41 "blendOptions": {
42 "opacity": 100,
43 "mode": "normal"
44 }
45 }
46 ],
47 "document": {
48 "name": "test.psd",
49 "width": 1000,
50 "height": 1000,
51 "bitDepth": 8,
52 "imageMode": "rgb",
53 "photoshopBuild": "Adobe Creative Imaging Service"
54 }
55 }
56 ],
57 "_links":{
58 "self":{
59 "href":"https://image.adobe.io/pie/psdService/status/8ec6e4f5-b580-41ac-b693-a72f150fec59"
60 }
61 }
62 }
63 }
64}

Auto tone an image through the Lightroom API

Step 1: Initiate a job to auto tone an image

Copied to your clipboard
1curl -X POST \
2 https://image.adobe.io/lrService/autoTone \
3 -H "Authorization: Bearer $token" \
4 -H "Content-Type: application/json" \
5 -H "x-api-key: <YOUR_API_KEY>" \
6 -H 'x-gw-ims-org-id: <YOUR_IMS_ORG_ID>' \
7 -d '{
8 "inputs": {
9 "href": "<SIGNED_GET_URL>",
10 "storage": "<storage>"
11 },
12 "outputs": [
13 {
14 "href": "<SIGNED_POST_URL>",
15 "type": "<type>",
16 "storage": "<storage>"
17 }
18 ]
19}'

This initiates an asynchronous job and returns a request body containing the href to poll for job status.

Copied to your clipboard
1{
2 "_links": {
3 "self": {
4 "href": "https://image.adobe.io/lrService/status/eb4a9211-eb8a-4e88-b853-b9c08ba47427"
5 }
6 }
7}

Step 2: Receive the Job's status on the Webhook application when the job is complete

The value in the key body inside the event JSON contains the result of the job. Here is a sample event received from the job initiated above:

Copied to your clipboard
1{
2 "event_id": "7b59cc70-88d7-4895-b204-87f5350a0cce",
3 "event": {
4 "header": {
5 "msgType": "JOB_COMPLETION_STATUS",
6 "msgId": "eb4a9211-eb8a-4e88-b853-b9c08ba47427",
7 "imsOrgId": "<YOUR_IMS_ORG_ID>",
8 "eventCode": "lightroom-job-status",
9 "_pipelineMeta": {
10 "pipelineMessageId": "1586290300876:944289:VA7_A1:149:0"
11 },
12 "_smarts": {
13 "definitionId": "3ee6c9056a9d72fc40e09ddf5fdbb0af752e8e49",
14 "runningSmartId": "psmart-yw6wosjksniuuathenny"
15 },
16 "_adobeio": {
17 "imsOrgId": "<YOUR_IMS_ORG_ID>",
18 "providerMetadata": "di_event_code",
19 "eventCode": "lightroom-job-status"
20 }
21 },
22 "body": {
23 "jobId": "eb4a9211-eb8a-4e88-b853-b9c08ba47427",
24 "outputs": [
25 {
26 "input": "<SIGNED_GET_URL>",
27 "status": "succeeded",
28 "_links": {
29 "self": [
30 {
31 "href": "<SIGNED_POST_URL>",
32 "storage": "<storage>"
33 }
34 ]
35 }
36 }
37 ],
38 "_links": {
39 "self": {
40 "href": "https://image.adobe.io/lrService/status/eb4a9211-eb8a-4e88-b853-b9c08ba47427"
41 }
42 }
43 }
44 }
45}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.