diff --git a/examples/javascript/photoshop/photoshop.js b/examples/javascript/photoshop/photoshop.js index 65bcfbe..57a4e3f 100644 --- a/examples/javascript/photoshop/photoshop.js +++ b/examples/javascript/photoshop/photoshop.js @@ -51,20 +51,19 @@ async function generateAndRemoveBackground(prompt) { console.log("Successfully generated the Firefly Image"); - // Use Photoshop autoCutout api to perform operation on the generated image. - const psInput = { - href: firstImageUrl, - storage: StorageType.EXTERNAL - }; - - const psOutput = { - href: "", // Generate Pre-signed PUT URL to save the generated output file. - storage: "" // example: StorageType.DROPBOX or StorageType.EXTERNAL or StorageType.AZURE - }; - + // Use Photoshop removeBackground v2 API to perform operation on the generated image. const psRequestBody = { - input: psInput, - output: psOutput + image: { + source: { + url: firstImageUrl + } + }, + mode: "cutout", + output: { + mediaType: "image/png" + }, + trim: false, + colorDecontamination: 1 } const removeBg = await photoshop.removeBackground(psRequestBody); // Remove Background diff --git a/examples/typescript/photoshop/photoshop.ts b/examples/typescript/photoshop/photoshop.ts index 2d0a2d4..9d4d82f 100644 --- a/examples/typescript/photoshop/photoshop.ts +++ b/examples/typescript/photoshop/photoshop.ts @@ -16,10 +16,9 @@ **************************************************************************/ -import { PhotoshopClient, RemoveBackgroundRequest, SenseiOutputDetails } from "@adobe/photoshop-apis"; +import { PhotoshopClient, RemoveBackgroundRequest } from "@adobe/photoshop-apis"; import { CoreTypes, FireflyClient, GenerateImagesResponse } from "@adobe/firefly-apis"; import { ServerToServerTokenProvider } from "@adobe/firefly-services-common-apis"; -import { StorageDetails, StorageType } from "@adobe/lightroom-apis"; /** * Function to generate an image and remove image background and save the file to the given output post pre-signed URL. @@ -55,20 +54,19 @@ async function generateAndRemoveBackground(prompt: string) { console.log("Successfully generated the Firefly Image"); - // Use Photoshop autoCutout api to perform operation on the generated image. - const psInput: StorageDetails = { - href: firstImageUrl ?? "", - storage: StorageType.EXTERNAL, - }; - - const psOutput: SenseiOutputDetails = { - href: "", // Generate Pre-signed PUT URL to save the generated output file. - storage: StorageType.EXTERNAL, // example: StorageType.DROPBOX or StorageType.EXTERNAL or StorageType.AZURE - }; - + // Use Photoshop removeBackground v2 API to perform operation on the generated image. const psRequestBody: RemoveBackgroundRequest = { - input: psInput, - output: psOutput, + image: { + source: { + url: firstImageUrl ?? "" + } + }, + mode: "cutout", + output: { + mediaType: "image/png" + }, + trim: false, + colorDecontamination: 1 }; const removeBg = await photoshop.removeBackground(psRequestBody); // Remove Background diff --git a/packages/photoshop/CHANGELOG.json b/packages/photoshop/CHANGELOG.json index e979ac3..a434969 100644 --- a/packages/photoshop/CHANGELOG.json +++ b/packages/photoshop/CHANGELOG.json @@ -1,6 +1,27 @@ { "name": "@adobe/photoshop-apis", "entries": [ + { + "version": "2.1.0", + "tag": "@adobe/photoshop-apis_v2.1.0", + "date": "Thu, 22 Jan 2026 19:37:53 GMT", + "comments": { + "minor": [ + { + "comment": " - Updated removeBackground API to use v2 endpoint (/v2/remove-background)" + }, + { + "comment": " - Removed deprecated `createMask` API" + }, + { + "comment": " - Updated API documentation links to new structure" + }, + { + "comment": " - Updated request/response types for v2 API compatibility" + } + ] + } + }, { "version": "2.0.1", "tag": "@adobe/photoshop-apis_v2.0.1", diff --git a/packages/photoshop/CHANGELOG.md b/packages/photoshop/CHANGELOG.md index d538445..56280f0 100644 --- a/packages/photoshop/CHANGELOG.md +++ b/packages/photoshop/CHANGELOG.md @@ -1,6 +1,17 @@ # Change Log - @adobe/photoshop-apis -This log was last generated on Tue, 24 Jun 2025 10:13:05 GMT and should not be manually modified. +This log was last generated on Thu, 22 Jan 2026 19:37:53 GMT and should not be manually modified. + +## 2.1.0 +Thu, 22 Jan 2026 19:37:53 GMT + +### Minor changes + +- - Updated removeBackground API to use v2 endpoint (/v2/remove-background) +- - Removed deprecated `createMask` API +- - Updated API documentation links to new structure +- - Updated request/response types for v2 API compatibility + ## 2.0.1 Tue, 24 Jun 2025 10:13:05 GMT diff --git a/packages/photoshop/README.md b/packages/photoshop/README.md index 8f13e34..d9f66b6 100644 --- a/packages/photoshop/README.md +++ b/packages/photoshop/README.md @@ -21,17 +21,16 @@ Table below shows details on various API service endpoints and the corresponding | Photoshop API Endpoint | SDK API Name | Description | |:----------|:----------|:----------| -| [/pie/psdService/photoshopActions](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_actions/) |[playPhotoshopActions](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#playphotoshopactions) |Executes Photoshop Action file against a PSD, JPEG, PNG, or TIFF. | -| [/pie/psdService/actionJSON](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_actionJSON/) |[playPhotoshopActionsJson](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#playphotoshopactionsjson) |Execute a Photoshop Action with actionJSON format. | -[/sensei/cutout](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_removeBackground/) |[removeBackground](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#removebackground) |Isolate subject of interested in an image and remove background.  | -| [/pie/psdService/documentCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_createPsd/) |[createDocument](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createdocument) |Create new PSD with layers. | -| [/sensei/mask](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_createMask/) |[createMask](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createmask) |Isolate a subject of interest in an image (people, objects, etc) and generate an image mask. | -| [/pie/psdService/renditionCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_createRendition/) |[createRendition](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createrendition) |Create flat image representations of a PSD in multiple formats. | -| [/pie/psdService/documentManifest](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_getManifest/) |[getDocumentManifest](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#getdocumentmanifest) |Extract metadata from PSD document, including general file and layer information. | -| [/pie/psdService/documentOperations](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_applyPsdEdits/) |[modifyDocument](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#modifydocument) |Apply basic layer edits (name, state, etc), add/edit adjustment, pixel, and shape layers.  | -| [/pie/psdService/smartObject](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_replaceSmartObject/) |[replaceSmartObject](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#replacesmartobject) |Replace Smart Object in a PSD. | -| [/pie/psdService/actionJsonCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_createActionJson/) |[convertToActionsJson](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#converttoactionsjson) |Convert .atn file to an actionJSON format. | -| [/pie/psdService/artboardCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_createArtboard/) |[createArtboard](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createartboard) |Create artboards from multiple PSD inputs. | -| [/pie/psdService/depthBlur](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_depthBlur/) |[applyDepthBlur](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#applydepthblur) |Apply depth blur to an image input. | -| [/pie/psdService/productCrop](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_productCrop/) |[applyAutoCrop](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#applyautocrop) |Smart crop an image keeping the subject of interest in view. | -| [/pie/psdService/text](https://developer.adobe.com/firefly-services/docs/photoshop/api/photoshop_editText/) |[editTextLayer](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#edittextlayer) |Change the contents of a text layer in a PSD, eg for localization. | +| [/pie/psdService/photoshopActions](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/playPhotoshopActionsAsync) |[playPhotoshopActions](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#playphotoshopactions) |Executes Photoshop Action file against a PSD, JPEG, PNG, or TIFF. | +| [/pie/psdService/actionJSON](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/playPhotoshopActionsJsonAsync) |[playPhotoshopActionsJson](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#playphotoshopactionsjson) |Execute a Photoshop Action with actionJSON format. | +| [/v2/remove-background](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/removeBackground) |[removeBackground](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#removebackground) |Isolate subject of interested in an image and remove background. | +| [/pie/psdService/documentCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/createDocumentAsync) |[createDocument](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createdocument) |Create new PSD with layers. | +| [/pie/psdService/renditionCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/createRenditionAsync) |[createRendition](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createrendition) |Create flat image representations of a PSD in multiple formats. | +| [/pie/psdService/documentManifest](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/getDocumentManifestAsync) |[getDocumentManifest](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#getdocumentmanifest) |Extract metadata from PSD document, including general file and layer information. | +| [/pie/psdService/documentOperations](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/modifyDocumentAsync) |[modifyDocument](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#modifydocument) |Apply basic layer edits (name, state, etc), add/edit adjustment, pixel, and shape layers. | +| [/pie/psdService/smartObject](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/replaceSmartObjectAsync) |[replaceSmartObject](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#replacesmartobject) |Replace Smart Object in a PSD. | +| [/pie/psdService/actionJsonCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/Photoshop/operation/actionJsonCreate) |[convertToActionsJson](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#converttoactionsjson) |Convert .atn file to an actionJSON format. | +| [/pie/psdService/artboardCreate](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/createArtboardAsync) |[createArtboard](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#createartboard) |Create artboards from multiple PSD inputs. | +| [/pie/psdService/depthBlur](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/applyDepthBlurAsync) |[applyDepthBlur](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#applydepthblur) |Apply depth blur to an image input. | +| [/pie/psdService/productCrop](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/applyAutoCropAsync) |[applyAutoCrop](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#applyautocrop) |Smart crop an image keeping the subject of interest in view. | +| [/pie/psdService/text](https://developer.adobe.com/firefly-services/docs/photoshop/api/#operation/editTextLayerAsync) |[editTextLayer](https://github.com/Firefly-Services/firefly-services-sdk-js/blob/main/docs/photoshop/classes/PhotoshopClient.md#edittextlayer) |Change the contents of a text layer in a PSD, eg for localization. | diff --git a/packages/photoshop/package.json b/packages/photoshop/package.json index e21230d..4c99673 100644 --- a/packages/photoshop/package.json +++ b/packages/photoshop/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/photoshop-apis", - "version": "2.0.1", + "version": "2.1.0", "author": "Adobe", "license": "Copyright (c) 2024 Adobe Inc", "description": "Adobe Firefly Services library for consuming Photoshop Service APIs.", diff --git a/packages/photoshop/src/Photoshop.ts b/packages/photoshop/src/Photoshop.ts index 3a6449d..6cc1263 100644 --- a/packages/photoshop/src/Photoshop.ts +++ b/packages/photoshop/src/Photoshop.ts @@ -29,7 +29,6 @@ import type { ApplyDepthBlurRequest } from "./models/ApplyDepthBlurRequest"; import type { ConvertToActionsJsonRequest } from "./models/ConvertToActionsJsonRequest"; import type { CreateArtboardRequest } from "./models/CreateArtboardRequest"; import type { CreateDocumentRequest } from "./models/CreateDocumentRequest"; -import type { CreateMaskRequest } from "./models/CreateMaskRequest"; import type { CreateRenditionRequest } from "./models/CreateRenditionRequest"; import type { DocumentManifestRequest } from "./models/DocumentManifestRequest"; import type { EditTextLayerRequest } from "./models/EditTextLayerRequest"; @@ -309,7 +308,7 @@ export class PhotoshopClient extends BaseServiceClient { ); } /** - * Remove Background API + * Remove Background API (v2) * Isolate subject of interest in an image and remove background. * @param requestBody The input image and the cutout mask parameters * @param options Additional options to send any additional data or cancel the request @@ -325,21 +324,4 @@ export class PhotoshopClient extends BaseServiceClient { this._photoshopAsyncClient.senseiJobStatus ); } - /** - * Create Mask API - * Isolate a subject of interest in an image (people, objects, etc) and generate an image mask - * @param requestBody The input image and the mask parameters - * @param options Additional options to send any additional data or cancel the request - * @returns SenseiJobApiResponse Job status - * @throws {ApiError} - */ - public async createMask( - requestBody: CreateMaskRequest, - options?: ApiOptions - ): Promise> { - return new SenseiAsyncJob( - this._photoshopAsyncClient.createMaskAsync(requestBody, options), - this._photoshopAsyncClient.senseiJobStatus - ); - } } diff --git a/packages/photoshop/src/PhotoshopAsyncClient.ts b/packages/photoshop/src/PhotoshopAsyncClient.ts index dc278e1..affb789 100644 --- a/packages/photoshop/src/PhotoshopAsyncClient.ts +++ b/packages/photoshop/src/PhotoshopAsyncClient.ts @@ -24,7 +24,6 @@ import type { ApplyDepthBlurRequest } from "./models/ApplyDepthBlurRequest"; import type { ConvertToActionsJsonRequest } from "./models/ConvertToActionsJsonRequest"; import type { CreateArtboardRequest } from "./models/CreateArtboardRequest"; import type { CreateDocumentRequest } from "./models/CreateDocumentRequest"; -import type { CreateMaskRequest } from "./models/CreateMaskRequest"; import type { CreateRenditionRequest } from "./models/CreateRenditionRequest"; import type { DocumentManifestRequest } from "./models/DocumentManifestRequest"; import type { EditTextLayerRequest } from "./models/EditTextLayerRequest"; @@ -428,7 +427,7 @@ export class PhotoshopAsyncClient extends BaseServiceClient { }); }; /** - * Remove Background API + * Remove Background API (v2) * Isolate subject of interest in an image and remove background. * @param requestBody The input image and the cutout mask parameters * @param options Additional options to send any additional data or cancel the request @@ -441,35 +440,7 @@ export class PhotoshopAsyncClient extends BaseServiceClient { ): Promise> { return this._httpRequest.request({ method: "POST", - url: "/sensei/cutout", - body: requestBody, - mediaType: "application/json", - errors: { - 400: `InputValidationError`, - 402: `Trial Limit Exceeded Error`, - 403: `Unauthorized`, - 404: `Requested resource was not found`, - 409: `Unable to upload asset`, - 410: `Asset Link Invalid` - }, - signal: options?.signal - }); - } - /** - * Create Mask API - * Isolate a subject of interest in an image (people, objects, etc) and generate an image mask - * @param requestBody The input image and the mask parameters - * @param options Additional options to send any additional data or cancel the request - * @returns JobStatusLinkResponse response - * @throws {ApiError} - */ - public createMaskAsync( - requestBody: CreateMaskRequest, - options?: ApiOptions - ): Promise> { - return this._httpRequest.request({ - method: "POST", - url: "/sensei/mask", + url: "/v2/remove-background", body: requestBody, mediaType: "application/json", errors: { diff --git a/packages/photoshop/src/index.ts b/packages/photoshop/src/index.ts index 217f0bc..c229b00 100644 --- a/packages/photoshop/src/index.ts +++ b/packages/photoshop/src/index.ts @@ -53,7 +53,6 @@ export { CompressionType } from "./models/CompressionType"; export type { ConvertToActionsJsonRequest } from "./models/ConvertToActionsJsonRequest"; export type { CreateArtboardRequest } from "./models/CreateArtboardRequest"; export type { CreateDocumentRequest } from "./models/CreateDocumentRequest"; -export type { CreateMaskRequest } from "./models/CreateMaskRequest"; export type { CreateRenditionRequest } from "./models/CreateRenditionRequest"; export type { CropOptions } from "./models/CropOptions"; export type { DeleteDetails } from "./models/DeleteDetails"; @@ -118,7 +117,7 @@ export type { PlayPhotoshopActionsRequest } from "./models/PlayPhotoshopActionsR export type { PsJobApiResponse } from "./models/PsJobApiResponse"; export type { PsJobResponse } from "./models/PsJobResponse"; export type { PsOutputDetails } from "./models/PsOutputDetails"; -export type { RemoveBackgroundRequest } from "./models/RemoveBackgroundRequest"; +export type { BackgroundColor, ImageSource, ImageInput, RemoveBackgroundOutput, RemoveBackgroundRequest } from "./models/RemoveBackgroundRequest"; export type { RenditionLinkDetails } from "./models/RenditionLinkDetails"; export type { RenditionLinks } from "./models/RenditionLinks"; export type { ReplaceSmartObjectRequest } from "./models/ReplaceSmartObjectRequest"; diff --git a/packages/photoshop/src/models/CreateMaskRequest.ts b/packages/photoshop/src/models/CreateMaskRequest.ts deleted file mode 100644 index 26f7a22..0000000 --- a/packages/photoshop/src/models/CreateMaskRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/************************************************************************* - * ADOBE CONFIDENTIAL - * ___________________ - * - * Copyright 2025 Adobe - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - - **************************************************************************/ -import type { SenseiOutputDetails } from "./SenseiOutputDetails"; -import type { StorageDetails } from "./StorageDetails"; -export type CreateMaskRequest = { - input: StorageDetails; - output: SenseiOutputDetails; -}; diff --git a/packages/photoshop/src/models/RemoveBackgroundRequest.ts b/packages/photoshop/src/models/RemoveBackgroundRequest.ts index d72db70..743d2cc 100644 --- a/packages/photoshop/src/models/RemoveBackgroundRequest.ts +++ b/packages/photoshop/src/models/RemoveBackgroundRequest.ts @@ -15,9 +15,46 @@ * from Adobe. **************************************************************************/ -import type { SenseiOutputDetails } from "./SenseiOutputDetails"; -import type { StorageDetails } from "./StorageDetails"; +/** + * Background color for the output image + */ +export type BackgroundColor = { + red: number; + green: number; + blue: number; + alpha: number; +}; + +/** + * Image source for v2 API + */ +export type ImageSource = { + url: string; +}; + +/** + * Image input for v2 API + */ +export type ImageInput = { + source: ImageSource; +}; + +/** + * Output configuration for v2 API + */ +export type RemoveBackgroundOutput = { + mediaType: string; +}; + +/** + * Remove Background Request for v2 API + * Isolate subject of interest in an image and remove background. + */ export type RemoveBackgroundRequest = { - input: StorageDetails; - output: SenseiOutputDetails; + image: ImageInput; + mode: "cutout"; + output: RemoveBackgroundOutput; + trim?: boolean; + backgroundColor?: BackgroundColor; + colorDecontamination?: number; };