@adobe/adobe-photoshop-api-sdk
v1.1.1
Published
Adobe Photoshop API SDK
Downloads
14
Maintainers
Keywords
Readme
Adobe Photoshop API SDK Beta
To Get Started
You’ll need to have:
- Access to Photoshop API credentials. If you don't already have any you can create them by signing up here.
- Enter your project name and click on “Create credentials” and keep an eye out for the
config.zip
that will automatically download.
- Enter your project name and click on “Create credentials” and keep an eye out for the
- Access to AWS
Create AWS access key
- If you do not have an AWS access key already you will need to create one by going to AWS IAM console.
- Click on your user name.
- Click on "Security credentials"
- Scroll down the page and click on "Create access key"
- Select "Command Line Interface" and click "Next"
- Enter a name for your access key and click on “Create access key”
- 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
Set up AWS CLI
- Install AWS CLI
- Configure AWS CLI by running the following command in your terminal
aws configure
- If you already have an aws profile you would need to run
aws configure [--profile profile-name]
- You will need to enter the following information
- Add your AWS access key
- AWS Secret access key
- Default region (choose a region closest to you for faster processing)
- 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.
Download this project
- Open your terminal
- Run
git clone https://github.com/adobe/adobe-photoshop-api-sdk
to download the SDK. - Change directory into
adobe-photoshop-api-sdk
- Run
npm install
to install node modules - Unzip the config.zip file that downloaded at the start and save
private.key
asconfig/private.key
in this project - Open
config/adobe-template.js
, fill in the information, and saveconfig/adobe.js
- Everything you need to fill out the template can be found in your console
- Open
config/aws-template.js
, fill in the information, and saveconfig/aws.js
- See README to find where to get those information.
// Adobe Photoshop API Configuration
// https://developer.adobe.com/console/projects -> project -> Service Account (JWT)
const adobeConfig = {
clientId: "",
clientSecret: "",
technicalAccountId: "",
orgId: "",
metaScopes: ["ent_ccas_sdk"],
};
// AWS Configuration
// https://aws.amazon.com/console/
const awsConfig = {
region: "", // us-east-1
bucketName: "" // aws s3 bucket name
}
Sample Script
Run a sample script (src/sample/psapi/...)
- Run a sample
node src/sample/psapi/01_createCutout.js
- Find your output file in your S3 storage, output directory (ex: s3://<awsConfig.bucketName>/output/...)
Run a sample scrip for a batch job (src/sample/batch_script/...)
- 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
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/
)