Skip to main content

官方示例

1 替换智能对象内的图片

  • urlhttps://image.adobe.io/pie/psdService/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

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"
}
]}'

Example 2: Creating a SmartObject#

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

Copy

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

Example 3: Making a text layer edit#

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

Copy

curl -X POST \
https://image.adobe.io/pie/psdService/text \
-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": "My Text Layer",
"text": {
"content": "CHANGED TO NEW TEXT",
"orientation": "horizontal",
"characterStyles": [{
"size": 15,
"orientation": "horizontal",
"color": {
"red":255,
"green":0,
"blue":0
}
}],
"paragraphStyles": [{
"alignment": "right"
}]
}
}
]
},

"outputs":[
{
"href":"<SIGNED_POST_URL>",
"storage":"<storage>",
"type":"vnd.adobe.photoshop"
}
]
}'

Example 4: 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.

Copy

curl -X POST \
https://image.adobe.io/pie/psdService/text \
-H "Authorization: Bearer $token" \
-H "x-api-key: $apiKey" \
-H "Content-Type: application/json" \
-d '{
"inputs":[
{
"href":"<SIGNED_GET_URL>",
"storage":"<storage>"
}
],
"options":{
"fonts": {
"storage": "<storage>",
"href": "<SIGNED_GET_URL_TO_VeganStylePersonalUse.ttf>"
},
"layers":[
{
"name": "My Text Layer",
"text": {
"content": "CHANGED TO NEW TEXT",
"orientation": "horizontal",
"characterStyles": [{
"size": 15,
"orientation": "horizontal",
"color": {
"red":255,
"green":0,
"blue":0
}
}],
"paragraphStyles": [{
"alignment": "right"
}]
}
}
]
},
"outputs":[
{
"href":"<SIGNED_POST_URL>",
"storage":"<storage>",
"type":"vnd.adobe.photoshop"
}
]
}'

Example 5: 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

Copy

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 "storage": "<storage>",
18 "href": "<SIGNED_GET_URL_TO_VeganStylePersonalUse.ttf>"
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}'

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

Example 6: Making a simple edit#

Copy

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}'

Example 7: Swapping the image in a smart object layer#

In this example we are replacing the smartobject using documentOperations API

Copy

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

Example 8: Adding a new adjustment layer#

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

Copy

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

Example 9: 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.

Copy

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

Example 10: Create a document rendition#

Generate multiple output rendition with the Simple API renditionCreate

Copy

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

Example 11: 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:

Copy

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

Example 12: 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.

Copy

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.

Copy

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"

Example 13: 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

Copy

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}

Example 14: 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:

Copy

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}

Example 15 : Photoshop Actions - Play ALL actions in .atn file.#

Copy

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}'

Example 16 : 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).

Copy

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}'

Example 17: 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

Copy

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 "storage": "<storage>",
16 "href": "<SIGNED_GET_URL>"
17 }],
18 "layers": [
19 {
20 "name": "<name_of_text_layer_1_to_edit>",
21 "text": {
22 "orientation": "horizontal",
23 "contents": "New text Contents 1",
24 "antiAlias": "antiAliasSharp",
25 "characterStyles": [{
26 "autoKern": "metricsKern",
27 "fontPostScriptName": "<font_postscript_name>",
28 "fontCaps": "allCaps",
29 "size": 25,
30 "leading": 20,
31 "tracking": 20,
32 "syntheticBold": true,
33 "ligature": true,
34 "syntheticItalic": true,
35 "color": {
36 "blue": 100,
37 "green": 200,
38 "red": 163
39 }
40 }],
41 "paragraphStyles": [{
42 "align": "right"
43 }]
44 }
45 },
46 {
47 "name": "<name_of_text_layer_2_to_edit>",
48 "text": {
49 "contents": "New text Contents 2",
50 "characterStyles": [{
51 "size": 45,
52 "stylisticAlternates": true,
53 "leading": 100,
54 "tracking": 100,
55 "baseline": "subScript",
56 "strikethrough": true,
57 "underline": true,
58 "verticalScale": 150,
59 "horizontalScale": 200,
60 "color": {
61 "blue": 300,
62 "green": 100,
63 "red": 63
64 }
65 }]
66 }
67 }
68 ]
69 },
70 "outputs": [
71 {
72 "href": "<SIGNED_POST_URL>",
73 "type": "vnd.adobe.photoshop",
74 "storage": "<storage>"
75 }
76 ]
77}'

Example 18 : 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

Copy

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}'

Example 19 : 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.

Copy

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}'

Lightroom#


Example 1: Autotone an image#

Copy

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.

Copy

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.

Example 2: Autostraighten an image#

Copy

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.

Copy

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.

Example 3 : Apply presets to an image#

Copy

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.

Copy

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.

Example 4: Apply edits to an image#

Copy

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.

Copy

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.

Example 5: Apply xmp to an image#

Copy

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.

Copy

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.

Example 6: 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.

Copy

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

Copy

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}

Sensei#


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

Example 1: Generate image cutout#

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

Copy

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.

Copy

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

Copy

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

Copy

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}

Example 2: Generate image mask#

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

Customized Workflow#


Example 1: Generate cutout result as Photoshop path#

This workflow is ONLY for users who'd like to generate cutout result as Photoshop path instead of regular mask or cutout in above example 1 and example 2. You will need to chain API calls to ImageCutOut 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 ImageCutOut service to generate intermediate result as RGBA cutout
  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:

Copy

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.

Copy

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:

Copy

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}

Example 2: Auto tone an image through the Lightroom API#

Step 1: Initiate a job to auto tone an image#

Copy

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.

Copy

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:

Copy

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}