Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shazron/aio-lib-photoshop-api
Adobe I/O Photoshop API SDK
https://github.com/shazron/aio-lib-photoshop-api
Last synced: 3 months ago
JSON representation
Adobe I/O Photoshop API SDK
- Host: GitHub
- URL: https://github.com/shazron/aio-lib-photoshop-api
- Owner: shazron
- License: apache-2.0
- Fork: true (adobe/aio-lib-photoshop-api)
- Created: 2021-09-06T13:58:41.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-11T06:42:24.000Z (over 1 year ago)
- Last Synced: 2023-06-11T07:24:21.224Z (over 1 year ago)
- Language: JavaScript
- Size: 8.09 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Version](https://img.shields.io/npm/v/@adobe/aio-lib-photoshop-api.svg)](https://npmjs.org/package/@adobe/aio-lib-photoshop-api)
[![Downloads/week](https://img.shields.io/npm/dw/@adobe/aio-lib-photoshop-api.svg)](https://npmjs.org/package/@adobe/aio-lib-photoshop-api)
[![Build Status](https://travis-ci.com/adobe/aio-lib-photoshop-api.svg?branch=master)](https://travis-ci.com/adobe/aio-lib-photoshop-api)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/adobe/aio-lib-photoshop-api/master.svg?style=flat-square)](https://codecov.io/gh/adobe/aio-lib-photoshop-api/)# Adobe Photoshop API Library
### Rest API
The Rest API is documented at:
- [Public Documentation](https://adobedocs.github.io/photoshop-api-docs-pre-release/#api-Photoshop)
### Installing
```bash
$ npm install @adobe/aio-lib-photoshop-api
```### Usage
1) Initialize the SDK
```javascript
const sdk = require('@adobe/aio-lib-photoshop-api')async function sdkTest() {
try {
//initialize sdk
const client = await sdk.init('', '', '')
} catch (e) {
console.error(e)
}
}
```2) 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`.
```javascript
const sdk = require('@adobe/aio-lib-photoshop-api')async function sdkTest() {
try {
// initialize sdk
const client = await sdk.init('', '', '')// 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)
}
}
```### Usage with Adobe I/O Files access
1) 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.
```javascript
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('', '', '', files)
} catch (e) {
console.error(e)
}
}
```2) 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`.
```javascript
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('', '', '', 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)
}
}
```## Classes
- 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 defaultimage/png
is selected. - PhotoshopAPI
-
This class provides methods to call your PhotoshopAPI APIs.
Before calling any method initialize the instance by calling theinit
method on it
with valid values for orgId, apiKey and accessToken - Job
-
Abstraction around the Photoshop Services Jobs
## Functions
-
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.
## Typedefs
-
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
## 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.
**Kind**: global class
* [FileResolver](#FileResolver)
* [new FileResolver([files], [options])](#new_FileResolver_new)
* [.presignExpiryInSeconds](#FileResolver+presignExpiryInSeconds) : number
* [.defaultPathStorage](#FileResolver+defaultPathStorage) : [Storage
](#Storage)
* [.resolveInput(input)](#FileResolver+resolveInput) ⇒ [Input
](#Input)
* [.resolveInputs(inputs)](#FileResolver+resolveInputs) ⇒ [Array.<Input>
](#Input)
* [.resolveInputsDocumentOptions(options)](#FileResolver+resolveInputsDocumentOptions) ⇒ [CreateDocumentOptions
](#CreateDocumentOptions) \| [ModifyDocumentOptions
](#ModifyDocumentOptions) \| [ReplaceSmartObjectOptions
](#ReplaceSmartObjectOptions)
* [.resolveInputsPhotoshopActionsOptions(options)](#FileResolver+resolveInputsPhotoshopActionsOptions) ⇒ ApplyPhotoshopActionsOptions
* [.resolveOutput(output)](#FileResolver+resolveOutput) ⇒ [Output
](#Output)
* [.resolveOutputs(outputs)](#FileResolver+resolveOutputs) ⇒ [Array.<Output>
](#Output)
### new FileResolver([files], [options])
Construct a file resolver
| Param | Type | Description |
| --- | --- | --- |
| [files] | \*
| Adobe I/O Files instance |
| [options] | [FileResolverOptions
](#FileResolverOptions) | Options |
### fileResolver.presignExpiryInSeconds : number
Expiry time of presigned urls in seconds
**Kind**: instance property of [FileResolver
](#FileResolver)
### fileResolver.defaultPathStorage : [Storage
](#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)
### fileResolver.resolveInput(input) ⇒ [Input
](#Input)
Resolve input file from href to an object with href and storage
**Kind**: instance method of [FileResolver
](#FileResolver)
**Returns**: [Input
](#Input) - resolved input
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input or href to resolve |
### fileResolver.resolveInputs(inputs) ⇒ [Array.<Input>
](#Input)
Resolve input files from hrefs to an array of objects with href and storage
**Kind**: instance method of [FileResolver
](#FileResolver)
**Returns**: [Array.<Input>
](#Input) - resolved files
| Param | Type | Description |
| --- | --- | --- |
| inputs | string
\| Array.<string>
\| [Input
](#Input) \| [Array.<Input>
](#Input) | One or more files |
### fileResolver.resolveInputsDocumentOptions(options) ⇒ [CreateDocumentOptions
](#CreateDocumentOptions) \| [ModifyDocumentOptions
](#ModifyDocumentOptions) \| [ReplaceSmartObjectOptions
](#ReplaceSmartObjectOptions)
Resolve the font and layer inputs in the document options
**Kind**: instance method of [FileResolver
](#FileResolver)
**Returns**: [CreateDocumentOptions
](#CreateDocumentOptions) \| [ModifyDocumentOptions
](#ModifyDocumentOptions) \| [ReplaceSmartObjectOptions
](#ReplaceSmartObjectOptions) - Document options
| Param | Type | Description |
| --- | --- | --- |
| options | [CreateDocumentOptions
](#CreateDocumentOptions) \| [ModifyDocumentOptions
](#ModifyDocumentOptions) \| [ReplaceSmartObjectOptions
](#ReplaceSmartObjectOptions) | Document options |
### fileResolver.resolveInputsPhotoshopActionsOptions(options) ⇒ ApplyPhotoshopActionsOptions
Resolve the actions, fonts, and custom presets options
**Kind**: instance method of [FileResolver
](#FileResolver)
**Returns**: ApplyPhotoshopActionsOptions
- Photoshop Actions options
| Param | Type | Description |
| --- | --- | --- |
| options | ApplyPhotoshopActionsOptions
| Photoshop Actions options |
### fileResolver.resolveOutput(output) ⇒ [Output
](#Output)
Resolve output from href to an object with href, storage, and type
**Kind**: instance method of [FileResolver
](#FileResolver)
**Returns**: [Output
](#Output) - resolved files
| Param | Type | Description |
| --- | --- | --- |
| output | string
\| File
\| [Output
](#Output) | One or more output files |
### fileResolver.resolveOutputs(outputs) ⇒ [Array.<Output>
](#Output)
Resolve outputs from href to an object with href, storage, and type
**Kind**: instance method of [FileResolver
](#FileResolver)
**Returns**: [Array.<Output>
](#Output) - resolved files
| Param | Type | Description |
| --- | --- | --- |
| outputs | string
\| Array.<string>
\| File
\| Array.<File>
\| [Output
](#Output) \| [Array.<Output>
](#Output) | One or more output files |
## 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
**Kind**: global class
* [PhotoshopAPI](#PhotoshopAPI)
* [.orgId](#PhotoshopAPI+orgId) : string
* [.apiKey](#PhotoshopAPI+apiKey) : string
* [.accessToken](#PhotoshopAPI+accessToken) : string
* [.init(orgId, apiKey, accessToken, [files], [options])](#PhotoshopAPI+init) ⇒ [Promise.<PhotoshopAPI>
](#PhotoshopAPI)
* [.createCutout(input, output)](#PhotoshopAPI+createCutout) ⇒ [Job
](#Job)
* [.createMask(input, output)](#PhotoshopAPI+createMask) ⇒ [Job
](#Job)
* [.straighten(input, outputs)](#PhotoshopAPI+straighten) ⇒ [Job
](#Job)
* [.autoTone(input, output)](#PhotoshopAPI+autoTone) ⇒ [Job
](#Job)
* [.editPhoto(input, output, options)](#PhotoshopAPI+editPhoto) ⇒ [Job
](#Job)
* [.applyPreset(input, preset, output)](#PhotoshopAPI+applyPreset) ⇒ [Job
](#Job)
* [.applyPresetXmp(input, output, xmp)](#PhotoshopAPI+applyPresetXmp) ⇒ [Job
](#Job)
* [.createDocument(outputs, options)](#PhotoshopAPI+createDocument) ⇒ [Job
](#Job)
* [.getDocumentManifest(input, [options])](#PhotoshopAPI+getDocumentManifest) ⇒ [Job
](#Job)
* [.modifyDocument(input, outputs, options)](#PhotoshopAPI+modifyDocument) ⇒ [Job
](#Job)
* [.createRendition(input, outputs)](#PhotoshopAPI+createRendition) ⇒ [Job
](#Job)
* [.replaceSmartObject(input, outputs, options)](#PhotoshopAPI+replaceSmartObject) ⇒ [Job
](#Job)
* [.applyPhotoshopActions(input, outputs, options)](#PhotoshopAPI+applyPhotoshopActions) ⇒ [Job
](#Job)
* [.applyPhotoshopActionsJson(input, outputs, options)](#PhotoshopAPI+applyPhotoshopActionsJson) ⇒ [Job
](#Job)
### photoshopAPI.orgId : string
The IMS organization id
**Kind**: instance property of [PhotoshopAPI
](#PhotoshopAPI)
### photoshopAPI.apiKey : string
The api key from your integration
**Kind**: instance property of [PhotoshopAPI
](#PhotoshopAPI)
### photoshopAPI.accessToken : string
The access token from your integration
**Kind**: instance property of [PhotoshopAPI
](#PhotoshopAPI)
### photoshopAPI.init(orgId, apiKey, accessToken, [files], [options]) ⇒ [Promise.<PhotoshopAPI>
](#PhotoshopAPI)
Initializes the PhotoshopAPI object and returns it.
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Promise.<PhotoshopAPI>
](#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
](#PhotoshopAPIOptions) | Options |
### photoshopAPI.createCutout(input, output) ⇒ [Job
](#Job)
Create a cutout mask, and apply it to the input
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Auto cutout job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| output | string
\| [Output
](#Output) | Output file |
### photoshopAPI.createMask(input, output) ⇒ [Job
](#Job)
Create a cutout mask
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Auto masking job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| output | string
\| [Output
](#Output) | Output file |
### photoshopAPI.straighten(input, outputs) ⇒ [Job
](#Job)
Straighten photo
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Auto straighten job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| outputs | string
\| [Output
](#Output) \| [Array.<Output>
](#Output) | Output file |
### photoshopAPI.autoTone(input, output) ⇒ [Job
](#Job)
Automatically tone photo
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Auto tone job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| output | string
\| [Output
](#Output) | Output file |
### photoshopAPI.editPhoto(input, output, options) ⇒ [Job
](#Job)
Apply a set of edit parameters on an image
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Edit photo job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| output | string
\| [Output
](#Output) | Output file |
| options | [EditPhotoOptions
](#EditPhotoOptions) | Edit options |
### photoshopAPI.applyPreset(input, preset, output) ⇒ [Job
](#Job)
Apply a preset on an image
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Apply preset job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| preset | string
\| [Input
](#Input) | Lightroom preset XMP file |
| output | string
\| [Output
](#Output) | Output file |
### photoshopAPI.applyPresetXmp(input, output, xmp) ⇒ [Job
](#Job)
Apply a preset on an image
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Apply preset job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | Input file |
| output | string
\| [Output
](#Output) | Output file |
| xmp | string
| Lightroom preset XMP file contents |
### photoshopAPI.createDocument(outputs, options) ⇒ [Job
](#Job)
Create a new psd, optionally with layers, and then generate renditions and/or save as a psd
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Create document job
| Param | Type | Description |
| --- | --- | --- |
| outputs | string
\| Array.<string>
\| [Output
](#Output) \| [Array.<Output>
](#Output) | Desired output |
| options | [CreateDocumentOptions
](#CreateDocumentOptions) | Document create options |
### photoshopAPI.getDocumentManifest(input, [options]) ⇒ [Job
](#Job)
Extract and return a psd file's layer information
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Get document manifest job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#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
](#MimeType) | desired image format. Allowed values: "image/jpeg", "image/png", "image/tiff" |
### photoshopAPI.modifyDocument(input, outputs, options) ⇒ [Job
](#Job)
Apply (optional) psd edits and then generate renditions and/or save a new psd
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Modify document job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#Input) | An object describing an input PSD file. Current support is for files less than 1000MB. |
| outputs | string
\| Array.<string>
\| [Output
](#Output) \| [Array.<Output>
](#Output) | Desired output |
| options | [ModifyDocumentOptions
](#ModifyDocumentOptions) | Modify document options |
### photoshopAPI.createRendition(input, outputs) ⇒ [Job
](#Job)
Create renditions
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Create rendition job
| Param | Type | Description |
| --- | --- | --- |
| input | string
\| [Input
](#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
](#Output) \| [Array.<Output>
](#Output) | Desired output |
### photoshopAPI.replaceSmartObject(input, outputs, options) ⇒ [Job
](#Job)
Apply psd edits for replacing embedded smart object and then generate renditions and/or save a new psd
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Replace smart object job
| Param | Type | Description |
| --- | --- | --- |
| input | [Input
](#Input) | An object describing an input PSD file. Current support is for files less than 1000MB. |
| outputs | string
\| [Output
](#Output) \| [Array.<Output>
](#Output) | Desired output |
| options | [ReplaceSmartObjectOptions
](#ReplaceSmartObjectOptions) | Replace smart object options |
### photoshopAPI.applyPhotoshopActions(input, outputs, options) ⇒ [Job
](#Job)
Apply Photoshop Actions and then generate renditions and/or save a new image
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Photoshop Actions job
| Param | Type | Description |
| --- | --- | --- |
| input | [Input
](#Input) | An object describing an input image file. Current support is for files less than 1000MB. |
| outputs | string
\| [Output
](#Output) \| [Array.<Output>
](#Output) | Desired output |
| options | ApplyPhotoshopActionsOptions
| Apply Photoshop Actions options |
### photoshopAPI.applyPhotoshopActionsJson(input, outputs, options) ⇒ [Job
](#Job)
Apply JSON-formatted Photoshop Actions and then generate renditions and/or save a new image
**Kind**: instance method of [PhotoshopAPI
](#PhotoshopAPI)
**Returns**: [Job
](#Job) - Photoshop Actions job
| Param | Type | Description |
| --- | --- | --- |
| input | [Input
](#Input) | An object describing an input image file. Current support is for files less than 1000MB. |
| outputs | string
\| [Output
](#Output) \| [Array.<Output>
](#Output) | Desired output |
| options | ApplyPhotoshopActionsJsonOptions
| Apply Photoshop Actions JSON options |
## Job
Abstraction around the Photoshop Services Jobs
**Kind**: global class
* [Job](#Job)
* [new Job(response, getJobStatus)](#new_Job_new)
* [.url](#Job+url) : string
* [.jobId](#Job+jobId) : string
* [.outputs](#Job+outputs) : [Array.<JobOutput>
](#JobOutput)
* [.isDone()](#Job+isDone) ⇒ boolean
* [.poll()](#Job+poll) ⇒ [Job
](#Job)
* [.pollUntilDone([pollTimeMs])](#Job+pollUntilDone) ⇒ [Job
](#Job)
### new Job(response, getJobStatus)
Construct a job with the ability to acquire status updates
| Param | Type | Description |
| --- | --- | --- |
| response | \*
| Service response |
| getJobStatus | function
| Async function to get job status |
### job.url : string
URL to request a status update of the job
**Kind**: instance property of [Job
](#Job)
### job.jobId : string
Job identifier
**Kind**: instance property of [Job
](#Job)
### job.outputs : [Array.<JobOutput>
](#JobOutput)
Status of each output sub job
**Kind**: instance property of [Job
](#Job)
### job.isDone() ⇒ boolean
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
](#Job)
**Returns**: boolean
- True if the job is done, or false if it is still pending/running
### job.poll() ⇒ [Job
](#Job)
Poll for job status
**Kind**: instance method of [Job
](#Job)
**Returns**: [Job
](#Job) - Job instance
### job.pollUntilDone([pollTimeMs]) ⇒ [Job
](#Job)
Poll job until done
**Kind**: instance method of [Job
](#Job)
**Returns**: [Job
](#Job) - Job instance
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [pollTimeMs] | number
| 2000
| Polling time |
## Storage
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/ |
## MimeType
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` |
## PngCompression
Compression level for PNG: small, medium or large.
**Kind**: global enum
**Read only**: true
**Properties**
| Name | Default |
| --- | --- |
| SMALL | small
|
| MEDIUM | medium
|
| LARGE | large
|
## Colorspace
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
|
## StandardIccProfileNames
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
|
## CreateMaskType
Type of mask to create
**Kind**: global enum
**Read only**: true
**Properties**
| Name | Default | Description |
| --- | --- | --- |
| BINARY | binary
| Binary mask |
| SOFT | soft
| Soft mask |
## WhiteBalance
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
|
## ManageMissingFonts
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 |
## BackgroundFill
Background fill
**Kind**: global enum
**Read only**: true
**Properties**
| Name | Default |
| --- | --- |
| WHITE | white
|
| BACKGROUND_COLOR | backgroundColor
|
| TRANSPARENT | transparent
|
## LayerType
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 |
## BlendMode
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
|
## TextOrientation
Text orientation
**Kind**: global enum
**Read only**: true
**Properties**
| Name | Default |
| --- | --- |
| HORIZONTAL | horizontal
|
| VERTICAL | vertical
|
## ParagraphAlignment
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
|
## HorizontalAlignment
Horizontal alignment
**Kind**: global enum
**Read only**: true
**Properties**
| Name | Default |
| --- | --- |
| LEFT | left
|
| CENTER | center
|
| RIGHT | right
|
## VerticalAlignment
Vertical alignment
**Kind**: global enum
**Read only**: true
**Properties**
| Name | Default |
| --- | --- |
| TOP | top
|
| CENTER | center
|
| BOTTOM | bottom
|
## JobOutputStatus
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 |
## shouldRetryFetch(response) ⇒ boolean
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 |
## 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.
**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 |
## getFetchOptions(options) ⇒ \*
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>
](#PhotoshopAPI)
Returns a Promise that resolves with a new PhotoshopAPI object.
**Kind**: global function
**Returns**: [Promise.<PhotoshopAPI>
](#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
](#PhotoshopAPIOptions) | Options |
## FileResolverOptions : object
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 |
## PhotoshopAPIOptions : object
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 |
## Input : object
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) | Storage type, by default detected based on `href` |
## IccProfile : object
Either referencing a standard profile from [StandardIccProfileNames](#StandardIccProfileNames) in `profileName`, or a custom profile through `input`.
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| imageMode | [Colorspace
](#Colorspace) | Image mode |
| input | [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)`) |
## Output : object
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
](#Storage) | | (all) Storage type, by default detected based on `href` |
| [type] | [MimeType
](#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
](#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
](#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>
](#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
](#IccProfile) | | (document) Describes the ICC profile to convert to |
## EditPhotoOptions : object
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
](#WhiteBalance) | white balance |
## Bounds : object
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 |
## LayerMask : object
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 |
## BlendOptions : object
Layer blend options
**Kind**: global typedef
**Properties**
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [opacity] | number
| 100
| Opacity value of the layer |
| [blendMode] | [BlendMode
](#BlendMode) | "normal"
| Blend mode of the layer |
## BrightnessContrast : object
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) |
## Exposure : object
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) |
## HueSaturationChannel : object
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) |
## HueSaturation : object
Adjustment layer hue and saturation settings
**Kind**: global typedef
**Properties**
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [colorize] | boolean
| false
| Colorize |
| [channels] | [Array.<HueSaturationChannel>
](#HueSaturationChannel) | []
| An array of hashes representing the 'master' channel (the remaining five channels of 'magentas', 'yellows', 'greens', etc are not yet supported) |
## ColorBalance : object
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) |
## AdjustmentLayer : object
Adjustment layer settings
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| [brightnessContrast] | [BrightnessContrast
](#BrightnessContrast) | Brightness and contrast settings |
| [exposure] | [Exposure
](#Exposure) | Exposure settings |
| [hueSaturation] | [HueSaturation
](#HueSaturation) | Hue and saturation settings |
| [colorBalance] | [ColorBalance
](#ColorBalance) | Color balance settings |
## FontColorRgb : object
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) |
## FontColorCmyk : object
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) |
## FontColorGray : object
Font color settings for Gray mode (16-bit)
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| gray | number
| Gray color (0...32768) |
## FontColor : object
Font color settings
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| rgb | [FontColorRgb
](#FontColorRgb) | Font color settings for RGB mode (16-bit) |
| cmyk | [FontColorCmyk
](#FontColorCmyk) | Font color settings for CMYK mode (16-bit) |
| gray | [FontColorGray
](#FontColorGray) | Font color settings for Gray mode (16-bit) |
## CharacterStyle : object
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
](#TextOrientation) | "horizontal"
| Text orientation |
| [fontColor] | [FontColor
](#FontColor) | | The font color settings (one of rgb, cmyk, gray, lab) |
## ParagraphStyle : object
Paragraph style
**Kind**: global typedef
**Properties**
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [alignment] | [ParagraphAlignment
](#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 |
## TextLayer : object
Text layer settings
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| content | string
| The text string |
| [characterStyles] | [Array.<CharacterStyle>
](#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>
](#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. |
## SmartObject : object
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 |
## FillLayer : 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) |
## LayerReference : object
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. |
## AddLayerPosition : object
Position where to add the layer in the layer hierarchy
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| [insertAbove] | [LayerReference
](#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
](#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
](#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. |
## MoveLayerPosition : object
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
](#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
](#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
](#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 : object
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
](#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>
](#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
](#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
](#AdjustmentLayer) | | Adjustment layer attributes |
| [bounds] | [Bounds
](#Bounds) | | The bounds of the layer, applicable to: LAYER, TEXT_LAYER, ADJUSTMENT_LAYER, LAYER_SECTION, SMART_OBJECT, FILL_LAYER |
| [mask] | [LayerMask
](#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
](#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
](#FillLayer) | | Fill layer attributes |
| [text] | [TextLayer
](#TextLayer) | | Text layer attributes |
| [blendOptions] | [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
](#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
](#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
](#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
](#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. |
## SmartObjectLayer : object
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
](#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
](#Bounds) | | (all) The bounds of the layer, applicable to: LAYER, TEXT_LAYER, ADJUSTMENT_LAYER, LAYER_SECTION, SMART_OBJECT, FILL_LAYER |
| [add] | [AddLayerPosition
](#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 |
## ModifyDocumentOptions : object
Global Photoshop document modification options
**Kind**: global typedef
**Properties**
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [manageMissingFonts] | [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>
](#Input) | | Array of custom fonts needed in this document. Filename should be .otf |
| [document] | object
| | Document attributes |
| [document.canvasSize] | object
| | Crop parameters |
| [document.canvasSize.bounds] | [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>
](#Layer) | | An array of layer objects you wish to act upon (edit, add, delete). Any layer missing an "operations" block will be ignored. |
## CreateDocumentOptions : object
Photoshop document create options
**Kind**: global typedef
**Properties**
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [manageMissingFonts] | [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>
](#Input) | | Array of custom fonts needed in this document. Filename should be .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
](#BackgroundFill) | | Background fill |
| document.mode | [Colorspace
](#Colorspace) | | Color space |
| document.depth | number
| | Bit depth. Allowed values: 8, 16, 32 |
| [layers] | [Array.<Layer>
](#Layer) | | An array of layer objects representing the layers to be created, in the same order as provided (from top to bottom). |
## DocumentManifest : object
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
](#Colorspace) | Document image mode |
| bitDepth | number
| Bit depth. Allowed values: 8, 16, 32 |
## ReplaceSmartObjectOptions : object
Replace Smart Object options
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| layers | [Array.<SmartObjectLayer>
](#SmartObjectLayer) | An array of layer objects you wish to act upon (edit, add, delete). Any layer missing an "operations" block will be ignored. |
## JobError : object
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. |
## JobOutput : object
Job status and output
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| input | string
| The original input file path |
| status | [JobOutputStatus
](#JobOutputStatus) | Output status |
| created | string
| Created timestamp of the job |
| modified | string
| Modified timestamp of the job |
| [document] | [DocumentManifest
](#DocumentManifest) | (manifest) Information about the PSD file |
| [layer] | [Array.<Layer>
](#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>
](#Output) | (document) Created renditions |
| [_links.self] | [Output
](#Output) | (lightroom, sensei) Created output |
| [errors] | [JobError
](#JobError) | Any errors reported |
### Debug Logs
```bash
LOG_LEVEL=debug
```
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.
### Contributing
Contributions are welcome! Read the [Contributing Guide](./.github/CONTRIBUTING.md) for more information.
### Licensing
This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information.