The Rest API is documented at:
$ npm install @adobe/aio-lib-photoshop-api
- Initialize the SDK
const sdk = require('@adobe/aio-lib-photoshop-api')
async function sdkTest() {
try {
//initialize sdk
const client = await sdk.init('<ims org id>', '<api key>', '<valid auth token>')
} catch (e) {
console.error(e)
}
}
- Remove the background of a photo
This is the example of using the storage type of http://host/input.jpg
(External) and call the service to cutout the background, ask for JPEG output, and store the result in Adobe Creative Cloud file storage path/output.jpg
.
const sdk = require('@adobe/aio-lib-photoshop-api')
async function sdkTest() {
try {
// initialize sdk
const client = await sdk.init('<ims org id>', '<api key>', '<valid auth token>')
// call methods
const result = await client.createCutout({
href: 'http://host/input.jpg',
storage: sdk.Storage.EXTERNAL
}, {
href: 'path/output.png',
storage: sdk.Storage.ADOBE,
type: sdk.MimeType.PNG
})
} catch (e) {
console.error(e)
}
}
- Initialize the SDK with Adobe I/O Files access
Configuring the SDK like this will make plain paths reference locations in Adobe I/O Files.
const libFiles = require('@adobe/aio-lib-files')
const sdk = require('@adobe/aio-lib-photoshop-api')
async function sdkTest() {
try {
// initialize sdk
const files = await libFiles.init();
const client = await sdk.init('<ims org id>', '<api key>', '<valid auth token>', files)
} catch (e) {
console.error(e)
}
}
- Remove the background of a photo
This will automatically detect the storage type of http://host/input.jpg
(e.g. Azure, External) and call the service to cutout the background, ask for JPEG output, and store the result in Adobe I/O Files under path/output.jpg
.
const libFiles = require('@adobe/aio-lib-files')
const sdk = require('@adobe/aio-lib-photoshop-api')
async function sdkTest() {
try {
// initialize sdk
const files = await libFiles.init();
const client = await sdk.init('<ims org id>', '<api key>', '<valid auth token>', files)
// call methods
// auto cutout...
const result = await client.createCutout('http://host/input.jpg', 'path/output.jpg')
console.log(result)
// equivalent call without FileResolver...
const result = await client.createCutout({
href: 'http://host/input.jpg',
storage: sdk.Storage.EXTERNAL
}, {
href: 'path/output.png',
storage: sdk.Storage.AIO,
type: sdk.MimeType.PNG
})
} catch (e) {
console.error(e)
}
}
- FileResolver
Resolves the storage and mime type of files referenced in the API.
The storage type storage type is resolved for input and output files using the following heuristic:
- If the storage type is provided, it is used as-is
- If a URL is provided, the hostname is inspected to determine Azure, Dropbox, or External (default)
- If a path is provided, the path resolved to Adobe I/O Files if an instance is provided to the constructor, otherwise it's Creative Cloud
Path resolution can be overridden by the
defaultAdobeCloudPaths
option.The mime-type is resolved based on the extension of the pathname of the URL or the path. If no extension can be found or the extension is unknown, the default
image/png
is selected.- PhotoshopAPI
This class provides methods to call your PhotoshopAPI APIs. Before calling any method initialize the instance by calling the
init
method on it with valid values for orgId, apiKey and accessToken- Job
Abstraction around the Photoshop Services Jobs
- shouldRetryFetch(response) ⇒
boolean
Determine if we should retry fetch due to Server errors (server busy or other application errors)
- nodeFetchRetry(options) ⇒
function
Fetch a URL, with retry options provided or default retry options otherwise By default retries will happen for 14 seconds (3 retries at 1, 2 and then 4 seconds -- there cannot be enough time for anotehr retry after that) Retry will occur if error code 429 or >= 500 occurs.
- getFetchOptions(options) ⇒
*
Parse through options object and determine correct parameters to Swagger for desired fetch approach
- init(orgId, apiKey, accessToken, [files], [options]) ⇒
Promise.<PhotoshopAPI>
Returns a Promise that resolves with a new PhotoshopAPI object.
- FileResolverOptions :
object
File resolver options
- PhotoshopAPIOptions :
object
Photoshop API options
- Input :
object
A reference to an input file
- IccProfile :
object
Either referencing a standard profile from StandardIccProfileNames in
profileName
, or a custom profile throughinput
.- Output :
object
A reference to an output file, including output options
- EditPhotoOptions :
object
Set of edit parameters to apply to an image
- Bounds :
object
Layer bounds (in pixels)
- LayerMask :
object
Mask applied to an layer
- BlendOptions :
object
Layer blend options
- BrightnessContrast :
object
Adjustment layer brightness and contrast settings
- Exposure :
object
Adjustment layer exposure settings
- HueSaturationChannel :
object
Master channel hue and saturation settings
- HueSaturation :
object
Adjustment layer hue and saturation settings
- ColorBalance :
object
Adjustment layer color balance settings
- AdjustmentLayer :
object
Adjustment layer settings
- FontColorRgb :
object
Font color settings for RGB mode (16-bit)
- FontColorCmyk :
object
Font color settings for CMYK mode (16-bit)
- FontColorGray :
object
Font color settings for Gray mode (16-bit)
- FontColor :
object
Font color settings
- CharacterStyle :
object
Character style settings
- ParagraphStyle :
object
Paragraph style
- TextLayer :
object
Text layer settings
- SmartObject :
object
Smart object settings
- FillLayer :
object
Fill layer settings
- LayerReference :
object
Layer reference
- AddLayerPosition :
object
Position where to add the layer in the layer hierarchy
- MoveLayerPosition :
object
Position where to move the layer to in the layer hierarchy
- Layer :
object
Layer to add, replace, move or delete when manipulating a Photoshop document, or retrieved from the manifest
- SmartObjectLayer :
object
Smart object layer to add or replace
- ModifyDocumentOptions :
object
Global Photoshop document modification options
- CreateDocumentOptions :
object
Photoshop document create options
- DocumentManifest :
object
Photoshop document manifest
- ReplaceSmartObjectOptions :
object
Replace Smart Object options
- JobError :
object
Reported job errors
- JobOutput :
object
Job status and output
Resolves the storage and mime type of files referenced in the API.
The storage type storage type is resolved for input and output files using the following heuristic:
- If the storage type is provided, it is used as-is
- If a URL is provided, the hostname is inspected to determine Azure, Dropbox, or External (default)
- If a path is provided, the path resolved to Adobe I/O Files if an instance is provided to the constructor, otherwise it's Creative Cloud
Path resolution can be overridden by the defaultAdobeCloudPaths
option.
The mime-type is resolved based on the extension of the pathname of the URL or the path. If no extension can
be found or the extension is unknown, the default image/png
is selected.
Kind: global class
- FileResolver
- new FileResolver([files], [options])
- .presignExpiryInSeconds :
number
- .defaultPathStorage :
Storage
- .resolveInput(input) ⇒
Input
- .resolveInputs(inputs) ⇒
Array.<Input>
- .resolveInputsDocumentOptions(options) ⇒
CreateDocumentOptions
|ModifyDocumentOptions
|ReplaceSmartObjectOptions
- .resolveInputsPhotoshopActionsOptions(options) ⇒
ApplyPhotoshopActionsOptions
- .resolveOutput(output) ⇒
Output
- .resolveOutputs(outputs) ⇒
Array.<Output>
Construct a file resolver
Param | Type | Description |
---|---|---|
[files] | * |
Adobe I/O Files instance |
[options] | FileResolverOptions |
Options |
Expiry time of presigned urls in seconds
Kind: instance property of FileResolver
fileResolver.defaultPathStorage : Storage
Plain paths can reference either Adobe Creative Cloud or Adobe I/O Files.
If an instance of files is provided, the default is considered to be Adobe I/O Files, otherwise it's Creative Cloud. The default can be overridden using the options
Kind: instance property of FileResolver
fileResolver.resolveInput(input) ⇒ Input
Resolve input file from href to an object with href and storage
Kind: instance method of FileResolver
Returns: Input
- resolved input
Param | Type | Description |
---|---|---|
input | string | Input |
Input or href to resolve |
fileResolver.resolveInputs(inputs) ⇒ Array.<Input>
Resolve input files from hrefs to an array of objects with href and storage
Kind: instance method of FileResolver
Returns: Array.<Input>
- resolved files
Param | Type | Description |
---|---|---|
inputs | string | Array.<string> | Input | Array.<Input> |
One or more files |
fileResolver.resolveInputsDocumentOptions(options) ⇒ CreateDocumentOptions
| ModifyDocumentOptions
| ReplaceSmartObjectOptions
Resolve the font and layer inputs in the document options
Kind: instance method of FileResolver
Returns: CreateDocumentOptions
| ModifyDocumentOptions
| ReplaceSmartObjectOptions
- Document options
Param | Type | Description |
---|---|---|
options | CreateDocumentOptions | ModifyDocumentOptions | ReplaceSmartObjectOptions |
Document options |
Resolve the actions, fonts, and custom presets options
Kind: instance method of FileResolver
Returns: ApplyPhotoshopActionsOptions
- Photoshop Actions options
Param | Type | Description |
---|---|---|
options | ApplyPhotoshopActionsOptions |
Photoshop Actions options |
fileResolver.resolveOutput(output) ⇒ Output
Resolve output from href to an object with href, storage, and type
Kind: instance method of FileResolver
Returns: Output
- resolved files
Param | Type | Description |
---|---|---|
output | string | File | Output |
One or more output files |
fileResolver.resolveOutputs(outputs) ⇒ Array.<Output>
Resolve outputs from href to an object with href, storage, and type
Kind: instance method of FileResolver
Returns: Array.<Output>
- resolved files
Param | Type | Description |
---|---|---|
outputs | string | Array.<string> | File | Array.<File> | Output | Array.<Output> |
One or more output files |
This class provides methods to call your PhotoshopAPI APIs.
Before calling any method initialize the instance by calling the init
method on it
with valid values for orgId, apiKey and accessToken
Kind: global class
- PhotoshopAPI
- .orgId :
string
- .apiKey :
string
- .accessToken :
string
- .init(orgId, apiKey, accessToken, [files], [options]) ⇒
Promise.<PhotoshopAPI>
- .createCutout(input, output) ⇒
Job
- .createMask(input, output) ⇒
Job
- .straighten(input, outputs) ⇒
Job
- .autoTone(input, output) ⇒
Job
- .editPhoto(input, output, options) ⇒
Job
- .applyPreset(input, preset, output) ⇒
Job
- .applyPresetXmp(input, output, xmp) ⇒
Job
- .createDocument(outputs, options) ⇒
Job
- .getDocumentManifest(input, [options]) ⇒
Job
- .modifyDocument(input, outputs, options) ⇒
Job
- .createRendition(input, outputs) ⇒
Job
- .replaceSmartObject(input, outputs, options) ⇒
Job
- .applyPhotoshopActions(input, outputs, options) ⇒
Job
- .orgId :
The IMS organization id
Kind: instance property of PhotoshopAPI
The api key from your integration
Kind: instance property of PhotoshopAPI
The access token from your integration
Kind: instance property of PhotoshopAPI
photoshopAPI.init(orgId, apiKey, accessToken, [files], [options]) ⇒ Promise.<PhotoshopAPI>
Initializes the PhotoshopAPI object and returns it.
Kind: instance method of PhotoshopAPI
Returns: Promise.<PhotoshopAPI>
- a PhotoshopAPI object
Param | Type | Description |
---|---|---|
orgId | string |
the IMS organization id |
apiKey | string |
the API key for your integration |
accessToken | string |
the access token for your integration |
[files] | * |
Adobe I/O Files instance |
[options] | PhotoshopAPIOptions |
Options |
photoshopAPI.createCutout(input, output) ⇒ Job
Create a cutout mask, and apply it to the input
Kind: instance method of PhotoshopAPI
Returns: Job
- Auto cutout job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
output | string | Output |
Output file |
photoshopAPI.createMask(input, output) ⇒ Job
Create a cutout mask
Kind: instance method of PhotoshopAPI
Returns: Job
- Auto masking job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
output | string | Output |
Output file |
photoshopAPI.straighten(input, outputs) ⇒ Job
Straighten photo
Kind: instance method of PhotoshopAPI
Returns: Job
- Auto straighten job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
outputs | string | Output | Array.<Output> |
Output file |
photoshopAPI.autoTone(input, output) ⇒ Job
Automatically tone photo
Kind: instance method of PhotoshopAPI
Returns: Job
- Auto tone job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
output | string | Output |
Output file |
photoshopAPI.editPhoto(input, output, options) ⇒ Job
Apply a set of edit parameters on an image
Kind: instance method of PhotoshopAPI
Returns: Job
- Edit photo job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
output | string | Output |
Output file |
options | EditPhotoOptions |
Edit options |
photoshopAPI.applyPreset(input, preset, output) ⇒ Job
Apply a preset on an image
Kind: instance method of PhotoshopAPI
Returns: Job
- Apply preset job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
preset | string | Input |
Lightroom preset XMP file |
output | string | Output |
Output file |
photoshopAPI.applyPresetXmp(input, output, xmp) ⇒ Job
Apply a preset on an image
Kind: instance method of PhotoshopAPI
Returns: Job
- Apply preset job
Param | Type | Description |
---|---|---|
input | string | Input |
Input file |
output | string | Output |
Output file |
xmp | string |
Lightroom preset XMP file contents |
photoshopAPI.createDocument(outputs, options) ⇒ Job
Create a new psd, optionally with layers, and then generate renditions and/or save as a psd
Kind: instance method of PhotoshopAPI
Returns: Job
- Create document job
Param | Type | Description |
---|---|---|
outputs | string | Array.<string> | Output | Array.<Output> |
Desired output |
options | CreateDocumentOptions |
Document create options |
photoshopAPI.getDocumentManifest(input, [options]) ⇒ Job
Extract and return a psd file's layer information
Kind: instance method of PhotoshopAPI
Returns: Job
- Get document manifest job
Param | Type | Description |
---|---|---|
input | string | Input |
An object describing an input PSD file.Current support is for files less than 1000MB. |
[options] | object |
available options to apply to all input files |
[options.thumbnails] | object |
Include presigned GET URLs to small preview thumbnails for any renderable layer. |
[options.thumbnails.type] | MimeType |
desired image format. Allowed values: "image/jpeg", "image/png", "image/tiff" |
photoshopAPI.modifyDocument(input, outputs, options) ⇒ Job
Apply (optional) psd edits and then generate renditions and/or save a new psd
Kind: instance method of PhotoshopAPI
Returns: Job
- Modify document job
Param | Type | Description |
---|---|---|
input | string | Input |
An object describing an input PSD file. Current support is for files less than 1000MB. |
outputs | string | Array.<string> | Output | Array.<Output> |
Desired output |
options | ModifyDocumentOptions |
Modify document options |
photoshopAPI.createRendition(input, outputs) ⇒ Job
Create renditions
Kind: instance method of PhotoshopAPI
Returns: Job
- Create rendition job
Param | Type | Description |
---|---|---|
input | string | Input |
An object describing an input file. Currently supported filetypes include: jpeg, png, psd, tiff. Current support is for files less than 1000MB. |
outputs | string | Array.<string> | Output | Array.<Output> |
Desired output |
photoshopAPI.replaceSmartObject(input, outputs, options) ⇒ Job
Apply psd edits for replacing embedded smart object and then generate renditions and/or save a new psd
Kind: instance method of PhotoshopAPI
Returns: Job
- Replace smart object job
Param | Type | Description |
---|---|---|
input | Input |
An object describing an input PSD file. Current support is for files less than 1000MB. |
outputs | string | Output | Array.<Output> |
Desired output |
options | ReplaceSmartObjectOptions |
Replace smart object options |
photoshopAPI.applyPhotoshopActions(input, outputs, options) ⇒ Job
Apply Photoshop Actions and then generate renditions and/or save a new psd
Kind: instance method of PhotoshopAPI
Returns: Job
- Photoshop Actions job
Param | Type | Description |
---|---|---|
input | Input |
An object describing an input image file. Current support is for files less than 1000MB. |
outputs | string | Output | Array.<Output> |
Desired output |
options | ApplyPhotoshopActionsOptions |
Apply Photoshop Actions options |
Abstraction around the Photoshop Services Jobs
Kind: global class
- Job
- new Job(response, getJobStatus)
- .url :
string
- .jobId :
string
- .outputs :
Array.<JobOutput>
- .isDone() ⇒
boolean
- .poll() ⇒
Job
- .pollUntilDone([pollTimeMs]) ⇒
Job
Construct a job with the ability to acquire status updates
Param | Type | Description |
---|---|---|
response | * |
Service response |
getJobStatus | function |
Async function to get job status |
URL to request a status update of the job
Kind: instance property of Job
Job identifier
Kind: instance property of Job
job.outputs : Array.<JobOutput>
Status of each output sub job
Kind: instance property of Job
Check if the job is done
A job is marked done when it has either the succeeded
or failed
status.
Kind: instance method of Job
Returns: boolean
- True if the job is done, or false if it is still pending/running
job.poll() ⇒ Job
Poll for job status
Kind: instance method of Job
Returns: Job
- Job instance
job.pollUntilDone([pollTimeMs]) ⇒ Job
Poll job until done
Kind: instance method of Job
Returns: Job
- Job instance
Param | Type | Default | Description |
---|---|---|---|
[pollTimeMs] | number |
2000 |
Polling time |
Storage types
Kind: global enum
Read only: true
Properties
Name | Default | Description |
---|---|---|
AIO | aio |
href is a path in Adobe I/O Files: https://github.com/adobe/aio-lib-files |
ADOBE | adobe |
href is a path in Creative Cloud |
EXTERNAL | external |
href is a presigned get/put url, e.g. AWS S3 |
AZURE | azure |
href is an Azure SAS (Shared Access Signature) URL for upload/download |
DROPBOX | dropbox |
href is a temporary upload/download Dropbox link: https://dropbox.github.io/dropbox-api-v2-explorer/ |
Mime types
Kind: global enum
Read only: true
Properties
Name | Default | Description |
---|---|---|
DNG | image/x-adobe-dng |
Digital Negative, available from autoTone , straighten , applyPreset |
JPEG | image/jpeg |
JPEG, available from all operations |
PNG | image/png |
PNG, available from all operations |
PSD | image/vnd.adobe.photoshop |
Photoshop Document, available from createDocument , modifyDocument , createRendition , replaceSmartObject |
TIFF | image/tiff |
TIFF format, available from createDocument , modifyDocument , createRendition , replaceSmartObject |
Compression level for PNG: small, medium or large.
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
SMALL | small |
MEDIUM | medium |
LARGE | large |
Color space
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
BITMAP | bitmap |
GREYSCALE | greyscale |
INDEXED | indexed |
RGB | rgb |
CMYK | cmyk |
MULTICHANNEL | multichannel |
DUOTONE | duotone |
LAB | lab |
Standard ICC profile names
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
ADOBE_RGB_1998 | Adobe RGB (1998) |
APPLE_RGB | Apple RGB |
COLORMATCH_RGB | ColorMatch RGB |
SRGB | sRGB IEC61966-2.1 |
DOTGAIN_10 | Dot Gain 10% |
DOTGAIN_15 | Dot Gain 15% |
DOTGAIN_20 | Dot Gain 20% |
DOTGAIN_25 | Dot Gain 25% |
DOTGAIN_30 | Dot Gain 30% |
GRAY_GAMMA_18 | Gray Gamma 1.8 |
GRAY_GAMMA_22 | Gray Gamma 2.2 |
Type of mask to create
Kind: global enum
Read only: true
Properties
Name | Default | Description |
---|---|---|
BINARY | binary |
Binary mask |
SOFT | soft |
Soft mask |
White balance enum
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
AS_SHOT | As Shot |
AUTO | Auto |
CLOUDY | Cloudy |
CUSTOM | Custom |
DAYLIGHT | Daylight |
FLASH | Flash |
FLUORESCENT | Fluorescent |
SHADE | Shade |
TUNGSTEN | Tungsten |
Action to take if there are one or more missing fonts in the document
Kind: global enum
Read only: true
Properties
Name | Default | Description |
---|---|---|
USE_DEFAULT | useDefault |
The job will succeed, however, by default all the missing fonts will be replaced with this font: ArialMT |
FAIL | fail |
The job will not succeed and the status will be set to "failed", with the details of the error provided in the "details" section in the status |
Background fill
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
WHITE | white |
BACKGROUND_COLOR | backgroundColor |
TRANSPARENT | transparent |
Layer type
Kind: global enum
Read only: true
Properties
Name | Default | Description |
---|---|---|
LAYER | layer |
A pixel layer |
TEXT_LAYER | textLayer |
A text layer |
ADJUSTMENT_LAYER | adjustmentLayer |
An adjustment layer |
LAYER_SECTION | layerSection |
Group of layers |
SMART_OBJECT | smartObject |
A smart object |
BACKGROUND_LAYER | backgroundLayer |
The background layer |
FILL_LAYER | fillLayer |
A fill layer |
Blend modes
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
NORMAL | normal |
DISSOLVE | dissolve |
DARKEN | darken |
MULTIPLY | multiply |
COLOR_BURN | colorBurn |
LINEAR_BURN | linearBurn |
DARKER_COLOR | darkerColor |
LIGHTEN | lighten |
SCREEN | screen |
COLOR_DODGE | colorDodge |
LINEAR_DODGE | linearDodge |
LIGHTER_COLOR | lighterColor |
OVERLAY | overlay |
SOFT_LIGHT | softLight |
HARD_LIGHT | hardLight |
VIVID_LIGHT | vividLight |
LINEAR_LIGHT | linearLight |
PIN_LIGHT | pinLight |
HARD_MIX | hardMix |
DIFFERENCE | difference |
EXCLUSION | exclusion |
SUBTRACT | subtract |
DIVIDE | divide |
HUE | hue |
SATURATION | saturation |
COLOR | color |
LUMINOSITY | luminosity |
Text orientation
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
HORIZONTAL | horizontal |
VERTICAL | vertical |
Paragraph alignment
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
LEFT | left |
CENTER | center |
RIGHT | right |
JUSTIFY | justify |
JUSTIFY_LEFT | justifyLeft |
JUSTIFY_CENTER | justifyCenter |
JUSTIFY_RIGHT | justifyRight |
Horizontal alignment
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
LEFT | left |
CENTER | center |
RIGHT | right |
Vertical alignment
Kind: global enum
Read only: true
Properties
Name | Default |
---|---|
TOP | top |
CENTER | center |
BOTTOM | bottom |
Output status
Kind: global enum
Read only: true
Properties
Name | Default | Description |
---|---|---|
PENDING | pending |
request has been accepted and is waiting to start |
RUNNING | running |
the child job is running |
UPLOADING | uploading |
files have been generated and are uploading to destination |
SUCCEEDED | succeeded |
the child job has succeeded |
FAILED | failed |
the child job has failed |
Determine if we should retry fetch due to Server errors (server busy or other application errors)
Kind: global function
Returns: boolean
- true if we should retry or false if not
Param | Type | Description |
---|---|---|
response | * |
Fetch response object, should at least have a status property which is the HTTP status code received |
Fetch a URL, with retry options provided or default retry options otherwise By default retries will happen for 14 seconds (3 retries at 1, 2 and then 4 seconds -- there cannot be enough time for anotehr retry after that) Retry will occur if error code 429 or >= 500 occurs.
Kind: global function
Returns: function
- Wrapped node fetch retry function which takes our preferred default options
Param | Type | Description |
---|---|---|
options | * |
Fetch options object, which can also include retryOptions described here https://github.com/adobe/node-fetch-retry |
Parse through options object and determine correct parameters to Swagger for desired fetch approach
Kind: global function
Returns: *
- Swagger options object with relevant settings for fetch module
Param | Type | Description |
---|---|---|
options | * |
Photoshop API options object |
init(orgId, apiKey, accessToken, [files], [options]) ⇒ Promise.<PhotoshopAPI>
Returns a Promise that resolves with a new PhotoshopAPI object.
Kind: global function
Returns: Promise.<PhotoshopAPI>
- a Promise with a PhotoshopAPI object
Param | Type | Description |
---|---|---|
orgId | string |
IMS organization id |
apiKey | string |
the API key for your integration |
accessToken | string |
the access token for your integration |
[files] | * |
Adobe I/O Files instance |
[options] | PhotoshopAPIOptions |
Options |
File resolver options
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[presignExpiryInSeconds] | number |
3600 |
Expiry time of any presigned urls, defaults to 1 hour |
[defaultAdobeCloudPaths] | boolean |
True if paths should be considered references to files in Creative Cloud |
Photoshop API options
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[presignExpiryInSeconds] | number |
3600 |
Expiry time of any presigned urls, defaults to 1 hour |
[defaultAdobeCloudPaths] | boolean |
True if paths should be considered references to files in Creative Cloud | |
[useSwaggerFetch] | boolean |
false |
True if Swagger's fetch implementation should be used, otherwise will use userFetch if provided or @adobe/node-fetch-retry if nothing else. |
[userFetch] | function |
Fetch function to use replacing Swagger's fetch and node-fetch-retry. Useful for mocking, etc |
A reference to an input file
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
href | string |
Either an href to a single Creative Cloud asset for storage='adobe' OR a presigned GET URL for other external services. |
[storage] | Storage |
Storage type, by default detected based on href |
Either referencing a standard profile from StandardIccProfileNames in profileName
, or a custom profile through input
.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
imageMode | Colorspace |
Image mode |
input | Input |
Custom ICC profile href to a Creative Cloud asset or presigned URL |
profileName | string |
Standard ICC profile name (e.g. Adobe RGB (1998) ) |
A reference to an output file, including output options
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
href | string |
(all) Either an href to a single Creative Cloud asset for storage='adobe' OR a presigned GET URL for other external services. | |
[storage] | Storage |
(all) Storage type, by default detected based on href |
|
[type] | MimeType |
(all) Desired output image format, by default detected based on href extension |
|
[overwrite] | boolean |
true |
(all) If the file already exists, indicates if the output file should be overwritten. Will eventually support eTags. Only applies to CC Storage |
[mask] | object |
(createMask, createCutout) Type of mask to create | |
mask.format | CreateMaskType |
(createMask, createCutout) Binary or soft mask to create | |
[width] | number |
0 |
(document) width, in pixels, of the renditions. Width of 0 generates a full size rendition. Height is not necessary as the rendition generate will automatically figure out the correct width-to-height aspect ratio. Only supported for image renditions |
[quality] | number |
7 |
(document) quality of the renditions for JPEG. Range from 1 to 7, with 7 as the highest quality. |
[compression] | PngCompression |
large |
(document) compression level for PNG: small, medium or large |
[trimToCanvas] | boolean |
false |
(document) 'false' generates renditions that are the actual size of the layer (as seen by View > Show > Layer Edges within the Photoshop desktop app) but will remove any extra transparent pixel padding. 'true' generates renditions that are the size of the canvas, either trimming the layer to the visible portion of the canvas or padding extra space. If the requested file format supports transparency than transparent pixels will be used for padding, otherwise white pixels will be used. |
[layers] | Array.<LayerReference> |
(document) An array of layer objects. By including this array you are signaling that you'd like a rendition created from these layer id's or layer names. Excluding it will generate a document-level rendition. | |
[iccProfile] | IccProfile |
(document) Describes the ICC profile to convert to |
Set of edit parameters to apply to an image
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
Contrast | number |
integer [ -100 .. 100 ] |
Saturation | number |
integer [ -100 .. 100 ] |
VignetteAmount | number |
integer [ -100 .. 100 ] |
Vibrance | number |
integer [ -100 .. 100 ] |
Highlights | number |
integer [ -100 .. 100 ] |
Shadows | number |
integer [ -100 .. 100 ] |
Whites | number |
integer [ -100 .. 100 ] |
Blacks | number |
integer [ -100 .. 100 ] |
Clarity | number |
integer [ -100 .. 100 ] |
Dehaze | number |
integer [ -100 .. 100 ] |
Texture | number |
integer [ -100 .. 100 ] |
Sharpness | number |
integer [ 0 .. 150 ] |
ColorNoiseReduction | number |
integer [ 0 .. 100 ] |
NoiseReduction | number |
integer [ 0 .. 100 ] |
SharpenDetail | number |
integer [ 0 .. 100 ] |
SharpenEdgeMasking | number |
integer [ 0 .. 10 ] |
Exposure | number |
float [ -5 .. 5 ] |
SharpenRadius | number |
float [ 0.5 .. 3 ] |
WhiteBalance | WhiteBalance |
white balance |
Layer bounds (in pixels)
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
top | number |
Top position of the layer |
left | number |
Left position of the layer |
width | number |
Layer width |
height | number |
Layer height |
Mask applied to an layer
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[clip] | boolean |
Indicates if this is a clipped layer | |
[enabled] | boolean |
true |
Indicates a mask is enabled on that layer or not. |
[linked] | boolean |
true |
Indicates a mask is linked to the layer or not. |
[offset] | object |
An object to specify mask offset on the layer. | |
[offset.x] | number |
0 |
Offset to indicate horizontal move of the mask |
[offset.y] | number |
0 |
Offset to indicate vertical move of the mask |
Layer blend options
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[opacity] | number |
100 |
Opacity value of the layer |
[blendMode] | BlendMode |
"normal" |
Blend mode of the layer |
Adjustment layer brightness and contrast settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[brightness] | number |
0 |
Adjustment layer brightness (-150...150) |
[contrast] | number |
0 |
Adjustment layer contrast (-150...150) |
Adjustment layer exposure settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[exposure] | number |
0 |
Adjustment layer exposure (-20...20) |
[offset] | number |
0 |
Adjustment layer exposure offset (-0.5...0.5) |
[gammaCorrection] | number |
1 |
Adjustment layer gamma correction (0.01...9.99) |
Master channel hue and saturation settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[channel] | string |
""master"" |
Allowed values: "master" |
[hue] | number |
0 |
Hue adjustment (-180...180) |
[saturation] | number |
0 |
Saturation adjustment (-100...100) |
[lightness] | number |
0 |
Lightness adjustment (-100...100) |
Adjustment layer hue and saturation settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[colorize] | boolean |
false |
Colorize |
[channels] | Array.<HueSaturationChannel> |
[] |
An array of hashes representing the 'master' channel (the remaining five channels of 'magentas', 'yellows', 'greens', etc are not yet supported) |
Adjustment layer color balance settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[preserveLuminosity] | boolean |
true |
Preserve luminosity |
[shadowLevels] | Array.<number> |
[0,0,0] |
Shadow levels (-100...100) |
[midtoneLevels] | Array.<number> |
[0,0,0] |
Midtone levels (-100...100) |
[highlightLevels] | Array.<number> |
[0,0,0] |
Highlight levels (-100...100) |
Adjustment layer settings
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[brightnessContrast] | BrightnessContrast |
Brightness and contrast settings |
[exposure] | Exposure |
Exposure settings |
[hueSaturation] | HueSaturation |
Hue and saturation settings |
[colorBalance] | ColorBalance |
Color balance settings |
Font color settings for RGB mode (16-bit)
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
red | number |
Red color (0...32768) |
green | number |
Green color (0...32768) |
blue | number |
Blue color (0...32768) |
Font color settings for CMYK mode (16-bit)
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
cyan | number |
Cyan color (0...32768) |
magenta | number |
Magenta color (0...32768) |
yellowColor | number |
Yellow color (0...32768) |
black | number |
Black color (0...32768) |
Font color settings for Gray mode (16-bit)
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
gray | number |
Gray color (0...32768) |
Font color settings
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
rgb | FontColorRgb |
Font color settings for RGB mode (16-bit) |
cmyk | FontColorCmyk |
Font color settings for CMYK mode (16-bit) |
gray | FontColorGray |
Font color settings for Gray mode (16-bit) |
Character style settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[from] | number |
The beginning of the range of characters that this characterStyle applies to. Based on initial index of 0. For example a style applied to only the first two characters would be from=0 and to=1 | |
[to] | number |
The ending of the range of characters that this characterStyle applies to. Based on initial index of 0. For example a style applied to only the first two characters would be from=0 and to=1 | |
[fontSize] | number |
Font size (in points) | |
[fontName] | string |
Font postscript name (see https://github.com/AdobeDocs/photoshop-api-docs/blob/master/SupportedFonts.md) | |
[orientation] | TextOrientation |
"horizontal" |
Text orientation |
[fontColor] | FontColor |
The font color settings (one of rgb, cmyk, gray, lab) |
Paragraph style
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[alignment] | ParagraphAlignment |
"left" |
Paragraph alignment |
[from] | number |
The beginning of the range of characters that this paragraphStyle applies to. Based on initial index of 0. For example a style applied to only the first two characters would be from=0 and to=1 | |
[to] | number |
The ending of the range of characters that this characterStyle applies to. Based on initial index of 0. For example a style applied to only the first two characters would be from=0 and to=1 |
Text layer settings
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
content | string |
The text string |
[characterStyles] | Array.<CharacterStyle> |
If the same supported attributes apply to all characters in the layer than this will be an array of one item, otherwise each characterStyle object will have a 'from' and 'to' value indicating the range of characters that the style applies to. |
[paragraphStyles] | Array.<ParagraphStyle> |
If the same supported attributes apply to all characters in the layer than this will be an array of one item, otherwise each paragraphStyle object will have a 'from' and 'to' value indicating the range of characters that the style applies to. |
Smart object settings
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
type | string |
Desired image format for the smart object | |
[linked] | boolean |
false |
Indicates if this smart object is linked. |
[path] | string |
Relative path for the linked smart object |
Fill layer settings
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
solidColor | object |
An object describing the solid color type for this fill layer. Currently supported mode is RGB only. |
solidColor.red | number |
Red color (0...255) |
solidColor.green | number |
Green color (0...255) |
solidColor.blue | number |
Blue color (0...255) |
Layer reference
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[id] | number |
The id of the layer you want to move above. Use either id OR name. |
[name] | string |
The name of the layer you want to move above. Use either id OR name. |
Position where to add the layer in the layer hierarchy
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[insertAbove] | LayerReference |
Used to add the layer above another. If the layer ID indicated is a group layer than the layer will be inserted above the group layer. |
[insertBelow] | LayerReference |
Used to add the layer below another. If the layer ID indicated is a group layer than the layer will be inserted below (and outside of) the group layer |
[insertInto] | LayerReference |
Used to add the layer inside of a group. Useful when you need to move a layer to an empty group. |
[insertTop] | boolean |
Indicates the layer should be added at the top of the layer stack. |
[insertBottom] | boolean |
Indicates the layer should be added at the bottom of the layer stack. If the image has a background image than the new layer will be inserted above it instead. |
Position where to move the layer to in the layer hierarchy
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[moveChildren] | boolean |
true |
If layer is a group layer than true = move the set as a unit. Otherwise an empty group is moved and any children are left where they were, un-grouped. |
[insertAbove] | LayerReference |
Used to move the layer above another. If the layer ID indicated is a group layer than the layer will be inserted above the group layer. | |
[insertBelow] | LayerReference |
Used to move the layer below another. If the layer ID indicated is a group layer than the layer will be inserted below (and outside of) the group layer | |
[insertInto] | LayerReference |
Used to move the layer inside of a group. Useful when you need to move a layer to an empty group. | |
[insertTop] | boolean |
Indicates the layer should be moved at the top of the layer stack. | |
[insertBottom] | boolean |
Indicates the layer should be moved at the bottom of the layer stack. If the image has a background image than the new layer will be inserted above it instead. |
Layer to add, replace, move or delete when manipulating a Photoshop document, or retrieved from the manifest
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
type | LayerType |
The layer type | |
[id] | number |
(modify, manifest) The layer id | |
[index] | number |
(modify, manifest) The layer index. Required when deleting a layer, otherwise not used | |
[children] | Array.<Layer> |
(manifest) An array of nested layer objects. Only layerSections (group layers) can include children | |
[thumbnail] | string |
(manifest) If thumbnails were requested, a presigned GET URL to the thumbnail | |
[name] | string |
Layer name | |
[locked] | boolean |
false |
Is the layer locked |
[visible] | boolean |
true |
Is the layer visible |
input | Input |
(create, modify) An object describing the input file to add or replace for a Pixel or Embedded Smart object layer. Supported image types are PNG or JPEG. Images support bounds. If the bounds do not reflect the width and height of the image the image will be resized to fit the bounds. Smart object replacement supports PNG, JPEG, PSD, SVG, AI, PDF. Added images are always placed at (top,left = 0,0) and bounds are ignored. Edited images are replaced for exact pixel size | |
[adjustments] | AdjustmentLayer |
Adjustment layer attributes | |
[bounds] | Bounds |
The bounds of the layer, applicable to: LAYER, TEXT_LAYER, ADJUSTMENT_LAYER, LAYER_SECTION, SMART_OBJECT, FILL_LAYER | |
[mask] | LayerMask |
An object describing the input mask to be added or replaced to the layer. Supported mask type is Layer Mask. The input file must be a greyscale image. Supported file types are jpeg, png and psd. | |
[smartObject] | SmartObject |
An object describing the attributes specific to creating or editing a smartObject. SmartObject properties need the input smart object file to operate on, which can be obtained from Input block. Currently we support Embedded Smart Object only. So this block is optional. If you are creating a Linked Smart Object, this is a required block. | |
[fill] | FillLayer |
Fill layer attributes | |
[text] | TextLayer |
Text layer attributes | |
[blendOptions] | BlendOptions |
Blend options of a layer, including opacity and blend mode | |
[fillToCanvas] | boolean |
false |
Indicates if this layer needs to be proportionally filled in to the entire canvas of the document. Applicable only to layer type="smartObject" or layer type="layer". |
[horizontalAlign] | HorizontalAlignment |
Indicates the horizontal position where this layer needs to be placed at. Applicable only to layer type="smartObject" or layer type="layer". | |
[verticalAlign] | VerticalAlignment |
Indicates the vertical position where this layer needs to be placed at. Applicable only to layer type="smartObject" or layer type="layer". | |
[edit] | object |
(modify) Indicates you want to edit the layer identified by it's id or name. Note the object is currently empty but leaves room for futher enhancements. The layer block should than contain changes from the original manifest. If you apply it to a group layer you will be effecting the attributes of the group layer itself, not the child layers | |
[move] | MoveLayerPosition |
(modify) Indicates you want to move the layer identified by it's id or name. You must also indicate where you want to move the layer by supplying one of the attributes insertAbove, insertBelow, insertInto, insertTop or insertBottom | |
[add] | AddLayerPosition |
(modify) Indicates you want to add a new layer. You must also indicate where you want to insert the new layer by supplying one of the attributes insertAbove, insertBelow, insertInto, insertTop or insertBottom After successful completion of this async request please call layers.read again in order to get a refreshed manifest with the latest layer indexes and any new layer id's. Currently supported layer types available for add are: layer, adjustmentLayer, textLayer, fillLayer | |
[delete] | boolean |
(modify) Indicates you want to delete the layer, including any children, identified by the id or name. Note the object is currently empty but leaves room for futher enhancements. |
Smart object layer to add or replace
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[id] | number |
(modify, smart object, manifest) they layer id | |
[name] | string |
(all) Layer name | |
[locked] | boolean |
false |
(all) Is the layer locked |
[visible] | boolean |
true |
(all) Is the layer visible |
input | Input |
(create, modify, smart object) An object describing the input file to add or replace for a Pixel or Embedded Smart object layer. Supported image types are PNG or JPEG. Images support bounds. If the bounds do not reflect the width and height of the image the image will be resized to fit the bounds. Smart object replacement supports PNG, JPEG, PSD, SVG, AI, PDF. Added images are always placed at (top,left = 0,0) and bounds are ignored. Edited images are replaced for exact pixel size | |
[bounds] | Bounds |
(all) The bounds of the layer, applicable to: LAYER, TEXT_LAYER, ADJUSTMENT_LAYER, LAYER_SECTION, SMART_OBJECT, FILL_LAYER | |
[add] | AddLayerPosition |
(modify, smart object) Indicates you want to add a new layer. You must also indicate where you want to insert the new layer by supplying one of the attributes insertAbove, insertBelow, insertInto, insertTop or insertBottom After successful completion of this async request please call layers.read again in order to get a refreshed manifest with the latest layer indexes and any new layer id's. Currently supported layer types available for add are: layer, adjustmentLayer, textLayer, fillLayer |
Global Photoshop document modification options
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[manageMissingFonts] | ManageMissingFonts |
'useDefault' |
Action to take if there are one or more missing fonts in the document |
[globalFont] | string |
The full postscript name of the font to be used as the global default for the document. This font will be used for any text layer which has a missing font and no other font has been specifically provided for that layer. If this font itself is missing, the option specified for manageMissingFonts from above will take effect. | |
[fonts] | Array.<Input> |
Array of custom fonts needed in this document. Filename should be <font_postscript_name>.otf | |
[document] | object |
Document attributes | |
[document.canvasSize] | object |
Crop parameters | |
[document.canvasSize.bounds] | Bounds |
The bounds to crop the document | |
[document.imageSize] | object |
Resize parameters. resizing a PSD always maintains the original aspect ratio by default. If the new width & height values specified in the parameters does not match the original aspect ratio, then the specified height will not be used and the height will be determined automatically | |
[document.imageSize.width] | number |
Resize width | |
[document.imageSize.height] | number |
Resize height | |
[document.trim] | object |
Image trim parameters | |
[document.trim.basedOn] | 'transparentPixels' |
'transparentPixels' |
Type of pixel to trim |
[layers] | Array.<Layer> |
An array of layer objects you wish to act upon (edit, add, delete). Any layer missing an "operations" block will be ignored. |
Photoshop document create options
Kind: global typedef
Properties
Name | Type | Default | Description |
---|---|---|---|
[manageMissingFonts] | ManageMissingFonts |
'useDefault' |
Action to take if there are one or more missing fonts in the document |
[globalFont] | string |
The full postscript name of the font to be used as the global default for the document. This font will be used for any text layer which has a missing font and no other font has been specifically provided for that layer. If this font itself is missing, the option specified for manageMissingFonts from above will take effect. | |
[fonts] | Array.<Input> |
Array of custom fonts needed in this document. Filename should be <font_postscript_name>.otf | |
document | object |
Document attributes | |
document.width | number |
Document width in pixels | |
document.height | number |
Document height in pixels | |
document.resolution | number |
Document resolution in pixels per inch. Allowed values: [72 ... 300]. | |
document.fill | BackgroundFill |
Background fill | |
document.mode | Colorspace |
Color space | |
document.depth | number |
Bit depth. Allowed values: 8, 16, 32 | |
[layers] | Array.<Layer> |
An array of layer objects representing the layers to be created, in the same order as provided (from top to bottom). |
Photoshop document manifest
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | string |
Name of the input file |
width | number |
Document width in pixels |
height | number |
Document height in pixels |
photoshopBuild | string |
Name of the application that created the PSD |
imageMode | Colorspace |
Document image mode |
bitDepth | number |
Bit depth. Allowed values: 8, 16, 32 |
Replace Smart Object options
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
layers | Array.<SmartObjectLayer> |
An array of layer objects you wish to act upon (edit, add, delete). Any layer missing an "operations" block will be ignored. |
Reported job errors
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
type | string |
A machine readable error type |
code | string |
A machine readable error code |
title | string |
A short human readable error summary |
errorDetails | Array.<object> |
Further descriptions of the exact errors where errorDetail is substituted for a specific issue. |
Job status and output
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
input | string |
The original input file path |
status | JobOutputStatus |
Output status |
created | string |
Created timestamp of the job |
modified | string |
Modified timestamp of the job |
[document] | DocumentManifest |
(manifest) Information about the PSD file |
[layer] | Array.<Layer> |
(manifest) A tree of layer objects representing the PSD layer structure extracted from the psd document |
[_links] | object |
Output references |
[_links.renditions] | Array.<Output> |
(document) Created renditions |
[_links.self] | Output |
(lightroom, sensei) Created output |
[errors] | JobError |
Any errors reported |
LOG_LEVEL=debug <your_call_here>
Prepend the LOG_LEVEL
environment variable and debug
value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.
Contributions are welcome! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.