This SDK will be deprecated and will no longer be supported. We recommend you switch to the new Firefly Services SDK which provides easy integration to Photoshop, Lightroom, Firefly, & Content Tagging API.
Once you have your credentials, the Adobe Photoshop API SDK can help you get started quickly by streamlining library installation and configuration, and providing sample content.
-
New Projects: With one command, the SDK will create a new Node.js project that you can build upon with all the dependencies needed to use the Photoshop API. This includes the Adobe Photoshop API Library along with sample code and test files.
-
Existing Projects: If you have an existing project or service that simply requires the addition of the Adobe Photoshop API Library, go to Adobe Photoshop API Library and follow the installation instructions.
npx create-adobe-photoshop-api-sdk my-project
cd my-project
Running these commands will create a directory called my-project inside the current folder. Inside that directory, it will generate the initial project structure and install the dependencies:
my-project
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── config (your credential information goes here)
│ ├── adobe-template.js
│ ├── aws-template.js
│ └── config.js
└── src
├── sample
│ ├── batch_script (This directory contains Photoshop API sample scripts for batch jobs)
│ └── psapi (This directory contains Photoshop API sample scripts for a single job)
└── testfiles (This directory contains test files that are used in sample scripts)
You need to configure your Photoshop API credentials.
-
Open
config/adobe-template.js
and save asconfig/adobe.js
. -
Fill out the information in
config/adobe.js
. Everything you need to fill out can be found in your console. If you have not created your credential yet, go to Getting started with Photoshop API.// Adobe Photoshop API Configuration // https://developer.adobe.com/console/projects -> project -> OAuth Server-to-Server const adobeConfig = { clientId: "", clientSecret: "", orgId: "" };
node src/sample/psapi/11_getDocumentManifest.js
You will receive an API response that shows a JSON manifest for input01.psd. The JSON manifest contains the tree representation of all of the layer objects contained in the PSD document.
Other sample scripts require output storage to be set up. Below are the setup instructions for AWS S3.
We support external services including AWS S3, Azure, Dropbox and Google Drive. To set up external storage using AWS S3, please follow the instructions below. More details are to follow for other storage providers.
- If you don't already have an AWS account you can create one.
- Once your account is created, [create an S3 bucket] (https://s3.console.aws.amazon.com/s3/buckets).
- Select “Create bucket” and name your bucket.
If you do not have an AWS access key already, you will need to create one by going to AWS Account and Access Keys. Copy and paste the “Secret access key” and store it in a safe place. You will need it in the next step. We recommend downloading the .csv file and storing it in a safe location as the Secret will not be accessible after you leave the screen
- Install AWS CLI
- Configure AWS CLI by running the following command in your terminal:
aws configure
- If you already have an aws profile, run
aws configure [--profile profile-name]
- You will need to enter the following information:
- Add your AWS access key
- Add your AWS Secret access key
- Choose a default region (Choose a region closest to you for faster processing.)
- Choose a default output (format: NONE)
- Test AWS CLI: Run the following command
aws s3 ls
to verify everything is configured correctly. The command should return a list of your available buckets. - Open
config/aws-template.js
, save asconfig/aws.js
, and fill in the information inconfig/aws.js
.
// AWS Configuration
// https://aws.amazon.com/console/
const awsConfig = {
accessKeyId: '',
secretAccessKey: '',
region: '',
bucketName: ''
}
- Run a sample script to remove the background of the image
node src/sample/psapi/01_createCutout.js
- Find your output file in your S3 storage, output directory (ex: s3://<awsConfig.bucketName>/output/...)
- Store multiple JPEG files in your S3 storage (ex: s3://<awsConfig.bucketName>/input/...) or modify input/output directories in the sample script.
// -------------------------------------------------
// Enter your parameters
// -------------------------------------------------
const inputDir = 'input/' //your input directory in S3 bucket (ex: s3://<awsConfig.bucketName>/input)
const outputDir = 'output' //your output directory in S3 bucket (ex: s3://<awsConfig.bucketName>/input/output)
const listObjectsInputRequest = { //URI Request Parameters
// Add more request as you like. see https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html for more details
Bucket: awsConfig.bucketName, //Bucket name to list.
Prefix: inputDir, // Keys that begin with the indicated prefix.
MaxKeys: 5 // Sets the maximum number of keys returned in the response. By default, the action returns up to 1,000 key names.
};
// -------------------------------------------------
- Run a sample script to remove the background of the multiple images
node src/sample/batch_job/01_createCutout_batch.js
- Find your output files in your S3 storage, output directory (ex: s3://<awsConfig.bucketName>/input/output/...)
- You can also use AWS CLI to sync files from your S3 storage into your local machine (ex:
aws s3 sync s3://<awsConfig.bucketName>/input/output/ /Users/<username>/Desktop/output/
)
API | Endpoint | Status | Sample | Feature Doc | API Doc |
---|---|---|---|---|---|
Execute Photoshop Actions | /pie/psdService/photoshopActions | Supported | 13_applyPhotoshopActions.js | Doc | API |
Remove Background | /sensei/cutout | Supported | 01_createCutout.js | Doc | API |
Create Mask | /sensei/mask | Supported | 02_createMask.js | Doc | API |
Rendering / Conversion | /pie/psdService/renditionCreate | Supported | 08_createRendition.js | Doc | API |
Create PSD | /pie/psdService/documentCreate | Supported | 09_createDocument.js | Doc | API |
Replace Smart Object | /pie/psdService/smartObject | Supported | 10_replaceSmartObject.js | Doc | API |
Get PSD Info (manifest) | /pie/psdService/documentManifest | Supported | 11_getDocumentManifest.js | N/A | API |
Edit PSD | /pie/psdService/documentOperations | Supported | 12_modifyDocument.js | Doc | API |
Autotone | /lrService/autoTone | Supported | 03_autoTone.js | Doc | API |
Auto Straighten | /lrService/autoStraighten | Supported | 04_straighten.js | Doc | API |
Preset | /lrService/presets | Supported | 05_applyPreset.js | Doc | API |
XMP | /lrService/xmp | Supported | 06_applyPresetXmp.js | Doc | API |
Edit Photo | /lrService/edit | Supported | 07_editPhoto.js | Doc | API |
actionJSON | /pie/psdService/actionJSON | Coming soon | N/A | Doc | API |
Product Crop | /pie/psdService/productCrop | Coming soon | N/A | Doc | API |
Depth Blur | /pie/psdService/depthBlur | Coming soon | N/A | Doc | API |
Edit text layers | /pie/psdService/text | Coming soon | N/A | Doc | API |
Create an artboard | /pie/psdService/artboardCreate | Coming soon | N/A | Doc | API |