{ "kind": "open-flow-workflow", "version": 1, "name": "Remove Background from Drive Images", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_e9710568ad78ed9c": { "name": "Watch for new Drive images", "kind": "poll", "config": { "changeType": { "kind": "value", "value": "created" }, "folderId": { "kind": "value", "value": "YOUR_INPUT_FOLDER_ID" }, "driveId": { "kind": "value", "value": "" }, "itemTypes": { "kind": "value", "value": [ "file" ] }, "mimeTypes": { "kind": "value", "value": [] }, "namePrefix": { "kind": "value", "value": "" }, "maxFilesPerPoll": { "kind": "value", "value": 50 } }, "definition": { "configInputs": [ { "jsonSchema": { "type": "string", "enum": [ "created", "updated" ] }, "nullable": false, "handle": "changeType" }, { "jsonSchema": { "type": "string", "pattern": "^[A-Za-z0-9_-]{0,512}$" }, "nullable": false, "handle": "driveId", "value": "" }, { "jsonSchema": { "type": "string", "pattern": "^[A-Za-z0-9_-]{2,512}$" }, "nullable": false, "handle": "folderId" }, { "jsonSchema": { "type": "array", "items": { "type": "string", "enum": [ "file", "folder" ] }, "minItems": 1, "uniqueItems": true }, "nullable": false, "handle": "itemTypes", "value": [ "file" ] }, { "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1 } }, "nullable": false, "handle": "mimeTypes", "value": [] }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "namePrefix", "value": "" }, { "collapsed": true, "group": "Advanced settings" }, { "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 200 }, "nullable": false, "handle": "maxFilesPerPoll", "value": 50 } ], "definitionVersion": 2, "description": "Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.", "displayName": "File or Folder Change in a Folder", "key": "googledrive.on_file_change", "name": "on_file_change", "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "createdTime": { "type": [ "string", "null" ] }, "driveId": { "type": [ "string", "null" ] }, "eventType": { "type": "string", "enum": [ "file_created", "file_updated", "folder_created", "folder_updated" ] }, "fileId": { "type": "string" }, "itemType": { "type": "string", "enum": [ "file", "folder" ] }, "lastModifyingUser": { "type": [ "object", "null" ] }, "mimeType": { "type": "string" }, "modifiedTime": { "type": [ "string", "null" ] }, "name": { "type": "string" }, "parents": { "type": "array", "items": { "type": "string" } }, "size": { "type": "string" }, "webViewLink": { "type": [ "string", "null" ] } }, "additionalProperties": false, "required": [ "eventType", "itemType", "fileId", "name", "mimeType", "createdTime", "modifiedTime", "parents", "webViewLink", "driveId", "lastModifyingUser" ] } }, "nullable": false, "handle": "events" } ], "provider": "googledrive", "type": "poll" }, "pollTimes": [ { "type": "every", "unit": "minute", "value": 1 } ] }, "n_fe8e1ef94d4210b8": { "inputs": { "events": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e9710568ad78ed9c", "output": "events" } ] }, "previousState": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_fe8e1ef94d4210b8", "output": "state" } ] }, "uploadId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c081352b877c513d", "output": "id" } ] }, "uploadName": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c081352b877c513d", "output": "name" } ] }, "uploadType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c081352b877c513d", "output": "mimeType" } ] } }, "name": "Prepare the next image", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "createdTime": { "type": [ "string", "null" ] }, "driveId": { "type": [ "string", "null" ] }, "eventType": { "type": "string", "enum": [ "file_created", "file_updated", "folder_created", "folder_updated" ] }, "fileId": { "type": "string" }, "itemType": { "type": "string", "enum": [ "file", "folder" ] }, "lastModifyingUser": { "type": [ "object", "null" ] }, "mimeType": { "type": "string" }, "modifiedTime": { "type": [ "string", "null" ] }, "name": { "type": "string" }, "parents": { "type": "array", "items": { "type": "string" } }, "size": { "type": "string" }, "webViewLink": { "type": [ "string", "null" ] } }, "additionalProperties": false, "required": [ "eventType", "itemType", "fileId", "name", "mimeType", "createdTime", "modifiedTime", "parents", "webViewLink", "driveId", "lastModifyingUser" ] } }, "nullable": false, "handle": "events" }, { "jsonSchema": { "type": "object", "properties": { "index": { "type": "integer", "minimum": 0 }, "completed": { "type": "array", "items": { "type": "object", "additionalProperties": true } } }, "required": [ "index", "completed" ], "additionalProperties": false }, "nullable": true, "handle": "previousState" }, { "jsonSchema": { "type": "string", "description": "The unique identifier of the file." }, "nullable": true, "handle": "uploadId" }, { "jsonSchema": { "type": "string", "description": "The name of the file." }, "nullable": true, "handle": "uploadName" }, { "jsonSchema": { "type": "string", "description": "The MIME type of the file." }, "nullable": true, "handle": "uploadType" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "index": { "type": "integer", "minimum": 0 }, "completed": { "type": "array", "items": { "type": "object", "additionalProperties": true } } }, "required": [ "index", "completed" ], "additionalProperties": false }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The ID of the file." }, "nullable": false, "handle": "fileId" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "count" } ], "name": "Prepare the next image", "moduleId": "n_a474d907ca8a1753", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_f0d5211f6945ecaf": { "inputs": {}, "name": "More images", "kind": "condition", "matchMode": "first", "cases": [ { "output": "process", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_fe8e1ef94d4210b8", "output": "more" } }, "operator": "==", "right": { "kind": "value", "value": true } } ] } ] } ] }, "n_b2a452c8efc1eafc": { "inputs": { "fileId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_fe8e1ef94d4210b8", "output": "fileId" } ] } }, "name": "Prepare the Drive metadata request", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "The ID of the file." }, "nullable": false, "handle": "fileId" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" } ], "name": "Prepare the Drive metadata request", "moduleId": "n_a2e53f05b5985bb2", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_56dbb1c91c96b55d": { "inputs": { "endpoint": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_b2a452c8efc1eafc", "output": "endpoint" } ] }, "query.fields": { "kind": "value", "value": "id,originalFilename" }, "query.supportsAllDrives": { "kind": "value", "value": true } }, "name": "Read the original filename", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "endpoint" }, { "jsonSchema": { "type": [ "string", "number", "boolean", "null" ] }, "nullable": true, "handle": "query.fields" }, { "jsonSchema": { "type": [ "string", "number", "boolean", "null" ] }, "nullable": true, "handle": "query.supportsAllDrives" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" }, { "jsonSchema": { "const": "base64" }, "nullable": true, "handle": "bodyEncoding" } ], "name": "Read the original filename", "executor": { "providerId": "googledrive", "method": "GET", "query": { "mode": "fields", "names": [ "fields", "supportsAllDrives" ] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "none", "kind": "connector-proxy" } } }, "n_3e6b49fe0619307c": { "inputs": { "fileId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_fe8e1ef94d4210b8", "output": "fileId" } ] }, "alt": { "kind": "value", "value": "media" } }, "name": "Download one Drive image", "kind": "task", "task": { "inputs": [ { "description": "The ID of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The ID of the file." }, "nullable": true, "handle": "fileId", "value": null }, { "description": "When true, includes files from shared drives.", "jsonSchema": { "type": "boolean", "description": "When true, includes files from shared drives." }, "nullable": true, "handle": "includeSharedDrives", "value": null }, { "description": "Return the file content instead of metadata.", "jsonSchema": { "const": "media", "description": "Return the file content instead of metadata." }, "nullable": true, "handle": "alt", "value": null }, { "description": "Whether to acknowledge the risk of downloading known malware or other abusive files.", "jsonSchema": { "type": "boolean", "description": "Whether to acknowledge the risk of downloading known malware or other abusive files." }, "nullable": true, "handle": "acknowledgeAbuse", "value": null } ], "outputs": [ { "description": "Drive file metadata or downloaded file content.", "jsonSchema": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "description": "The unique identifier of the file." }, "name": { "type": "string", "description": "The name of the file." }, "mimeType": { "type": "string", "description": "The MIME type of the file." }, "webViewLink": { "type": [ "string", "null" ], "description": "A link for opening the file in a relevant Google editor or viewer in a browser." }, "createdTime": { "type": [ "string", "null" ], "description": "The time at which the file was created (RFC 3339 date-time)." }, "modifiedTime": { "type": [ "string", "null" ], "description": "The last time the file was modified by anyone (RFC 3339 date-time)." }, "sizeBytes": { "type": [ "integer", "null" ], "description": "The size of the file's content in bytes." }, "driveId": { "type": [ "string", "null" ], "description": "The ID of the shared drive the file belongs to." }, "parents": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "The IDs of the parent folders containing the file." }, "owners": { "type": "array", "items": { "type": "object", "properties": { "displayName": { "type": [ "string", "null" ], "description": "The display name of the owner." }, "emailAddress": { "type": [ "string", "null" ], "description": "The email address of the owner." }, "permissionId": { "type": [ "string", "null" ], "description": "The permission ID of the owner." }, "photoLink": { "type": [ "string", "null" ], "description": "A link to the owner's profile photo." } }, "required": [ "displayName", "emailAddress", "permissionId", "photoLink" ], "additionalProperties": false, "description": "Schema for driveOwnerSchema." }, "description": "The owners of the file." }, "shared": { "type": "boolean", "description": "Whether the file has been shared." }, "starred": { "type": "boolean", "description": "Whether the user has starred the file." }, "trashed": { "type": "boolean", "description": "Whether the file has been trashed." }, "ownedByMe": { "type": "boolean", "description": "Whether the authenticated user owns the file." }, "capabilities": { "type": "object", "properties": { "canShare": { "type": "boolean", "description": "Whether the authenticated user may modify sharing settings." } }, "required": [ "canShare" ], "additionalProperties": false, "description": "The projected Drive capabilities for the authenticated user." } }, "required": [ "id", "name", "mimeType", "webViewLink", "createdTime", "modifiedTime", "sizeBytes", "driveId" ], "additionalProperties": false, "description": "Schema for driveFileSchema." }, { "type": "object", "properties": { "fileId": { "type": "string", "description": "The unique identifier of the downloaded file." }, "name": { "type": "string", "description": "The name of the downloaded file." }, "mimeType": { "type": "string", "description": "The MIME type of the downloaded file content." }, "sizeBytes": { "type": [ "integer", "null" ], "description": "The size of the downloaded file content in bytes." }, "transitUrl": { "type": "string", "description": "A temporary transit URL from which the file content can be retrieved." } }, "required": [ "fileId", "name", "mimeType", "sizeBytes", "transitUrl" ], "additionalProperties": false, "description": "Schema for fileContentOutputSchema." } ], "description": "Drive file metadata or downloaded file content." }, "nullable": false, "handle": "output" } ], "name": "Download one Drive image", "executor": { "kind": "connector", "action": "googledrive.files.get", "outputMode": "value" } } }, "n_2daabc01298e17d9": { "inputs": { "file": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3e6b49fe0619307c", "output": "output" } ] }, "expectedId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_fe8e1ef94d4210b8", "output": "fileId" } ] }, "metadata": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_56dbb1c91c96b55d", "output": "body" } ] }, "statusCode": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_56dbb1c91c96b55d", "output": "statusCode" } ] } }, "name": "Prepare the image URL", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "description": "The unique identifier of the file." }, "name": { "type": "string", "description": "The name of the file." }, "mimeType": { "type": "string", "description": "The MIME type of the file." }, "webViewLink": { "type": [ "string", "null" ], "description": "A link for opening the file in a relevant Google editor or viewer in a browser." }, "createdTime": { "type": [ "string", "null" ], "description": "The time at which the file was created (RFC 3339 date-time)." }, "modifiedTime": { "type": [ "string", "null" ], "description": "The last time the file was modified by anyone (RFC 3339 date-time)." }, "sizeBytes": { "type": [ "integer", "null" ], "description": "The size of the file's content in bytes." }, "driveId": { "type": [ "string", "null" ], "description": "The ID of the shared drive the file belongs to." }, "parents": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "The IDs of the parent folders containing the file." }, "owners": { "type": "array", "items": { "type": "object", "properties": { "displayName": { "type": [ "string", "null" ], "description": "The display name of the owner." }, "emailAddress": { "type": [ "string", "null" ], "description": "The email address of the owner." }, "permissionId": { "type": [ "string", "null" ], "description": "The permission ID of the owner." }, "photoLink": { "type": [ "string", "null" ], "description": "A link to the owner's profile photo." } }, "required": [ "displayName", "emailAddress", "permissionId", "photoLink" ], "additionalProperties": false, "description": "Schema for driveOwnerSchema." }, "description": "The owners of the file." }, "shared": { "type": "boolean", "description": "Whether the file has been shared." }, "starred": { "type": "boolean", "description": "Whether the user has starred the file." }, "trashed": { "type": "boolean", "description": "Whether the file has been trashed." }, "ownedByMe": { "type": "boolean", "description": "Whether the authenticated user owns the file." }, "capabilities": { "type": "object", "properties": { "canShare": { "type": "boolean", "description": "Whether the authenticated user may modify sharing settings." } }, "required": [ "canShare" ], "additionalProperties": false, "description": "The projected Drive capabilities for the authenticated user." } }, "required": [ "id", "name", "mimeType", "webViewLink", "createdTime", "modifiedTime", "sizeBytes", "driveId" ], "additionalProperties": false, "description": "Schema for driveFileSchema." }, { "type": "object", "properties": { "fileId": { "type": "string", "description": "The unique identifier of the downloaded file." }, "name": { "type": "string", "description": "The name of the downloaded file." }, "mimeType": { "type": "string", "description": "The MIME type of the downloaded file content." }, "sizeBytes": { "type": [ "integer", "null" ], "description": "The size of the downloaded file content in bytes." }, "transitUrl": { "type": "string", "description": "A temporary transit URL from which the file content can be retrieved." } }, "required": [ "fileId", "name", "mimeType", "sizeBytes", "transitUrl" ], "additionalProperties": false, "description": "Schema for fileContentOutputSchema." } ], "description": "Drive file metadata or downloaded file content." }, "nullable": false, "handle": "file" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The ID of the file." }, "nullable": false, "handle": "expectedId" }, { "jsonSchema": {}, "nullable": true, "handle": "metadata" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" } ], "outputs": [ { "jsonSchema": { "type": "string", "format": "uri", "minLength": 1 }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The name of the file." }, "nullable": true, "handle": "name" } ], "name": "Prepare the image URL", "moduleId": "n_ffc4625b119f1899", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_c1678c3c4948bb56": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2daabc01298e17d9", "output": "url" } ] } }, "name": "Read the original image size", "kind": "task", "task": { "inputs": [ { "description": "The remote image or video URL to inspect.", "jsonSchema": { "type": "string", "format": "uri", "description": "The remote image or video URL to inspect." }, "nullable": false, "handle": "url" } ], "outputs": [ { "description": "Image or video metadata returned by ImageKit.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Image or video metadata returned by ImageKit." }, "nullable": false, "handle": "metadata" } ], "name": "Read the original image size", "executor": { "kind": "connector", "action": "imagekit.get_remote_file_metadata" } } }, "n_f9da817b9536f0f9": { "inputs": { "metadata": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c1678c3c4948bb56", "output": "metadata" } ] }, "keepInputSize": { "kind": "value", "value": true }, "width": { "kind": "value", "value": 1600 }, "height": { "kind": "value", "value": 1600 }, "padding": { "kind": "value", "value": 0.05 } }, "name": "Choose size and background", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Image or video metadata returned by ImageKit." }, "nullable": false, "handle": "metadata" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "keepInputSize" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "width" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "height" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "padding" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "width": { "type": "integer", "exclusiveMinimum": 0, "description": "The output canvas width in pixels. Provide height with this field." }, "height": { "type": "integer", "exclusiveMinimum": 0, "description": "The output canvas height in pixels. Provide width with this field." }, "padding": { "type": "number", "minimum": 0, "exclusiveMaximum": 0.5, "description": "The fractional padding on every side of the subject, from 0 up to but excluding 0.5." }, "scaling": { "type": "string", "enum": [ "fit", "fill" ], "description": "Whether the subject should fit or fill the available canvas." }, "horizontalAlignment": { "type": "string", "enum": [ "left", "center", "right" ], "description": "The horizontal subject alignment." }, "verticalAlignment": { "type": "string", "enum": [ "top", "center", "bottom" ], "description": "The vertical subject alignment." } }, "additionalProperties": false, "description": "Output canvas sizing and subject positioning controls." }, "nullable": true, "handle": "canvas" } ], "name": "Choose size and background", "moduleId": "n_0cf86379318d6def", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_4f7d36cc3f849519": { "inputs": { "imageUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2daabc01298e17d9", "output": "url" } ] }, "background": { "kind": "value", "value": { "type": "color", "color": "white" } }, "canvas": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9da817b9536f0f9", "output": "canvas" } ] }, "outputFormat": { "kind": "value", "value": "png" } }, "name": "Remove the image background", "kind": "task", "task": { "inputs": [ { "description": "The publicly reachable source product image URL that Photoroom should edit.", "jsonSchema": { "type": "string", "minLength": 1, "format": "uri", "description": "The publicly reachable source product image URL that Photoroom should edit." }, "nullable": false, "handle": "imageUrl" }, { "description": "The background treatment applied to the product image.", "jsonSchema": { "oneOf": [ { "type": "object", "properties": { "type": { "const": "keep", "description": "The background strategy." }, "blurMode": { "type": "string", "enum": [ "gaussian", "bokeh" ], "description": "The blur style applied to the retained background." }, "blurRadius": { "type": "number", "exclusiveMinimum": 0, "maximum": 0.05, "description": "The background blur radius above 0 and up to 0.05." } }, "required": [ "type" ], "additionalProperties": false, "description": "Keep the source background, optionally blurring it." }, { "type": "object", "properties": { "type": { "const": "color", "description": "The background strategy." }, "color": { "type": "string", "minLength": 1, "description": "A hexadecimal color without a leading hash, such as FFFFFF or FF0000EE, or a supported color name." } }, "required": [ "type", "color" ], "additionalProperties": false, "description": "Replace the source background with a solid color." }, { "type": "object", "properties": { "type": { "const": "image", "description": "The background strategy." }, "imageUrl": { "type": "string", "minLength": 1, "format": "uri", "description": "The publicly reachable URL of the replacement background image." }, "scaling": { "type": "string", "enum": [ "fit", "fill" ], "description": "How the replacement background should fit the output canvas." } }, "required": [ "type", "imageUrl" ], "additionalProperties": false, "description": "Replace the source background with an image that Photoroom can fetch." }, { "type": "object", "properties": { "type": { "const": "ai", "description": "The background strategy." }, "prompt": { "type": "string", "minLength": 1, "description": "A description of the product scene to generate around the existing subject." }, "seed": { "type": "integer", "exclusiveMinimum": 0, "description": "A fixed generation seed for producing similar backgrounds from the same prompt." }, "expandPromptMode": { "type": "string", "enum": [ "ai.auto", "ai.never" ], "description": "Whether Photoroom should automatically expand a short background prompt." } }, "required": [ "type", "prompt" ], "additionalProperties": false, "description": "Generate a product-scene background from a controlled prompt." } ], "description": "The background treatment applied to the product image." }, "nullable": false, "handle": "background" }, { "description": "The current Photoroom AI shadow style generated around the detected product subject.", "jsonSchema": { "type": "string", "enum": [ "auto", "soft", "hard" ], "description": "The current Photoroom AI shadow style generated around the detected product subject." }, "nullable": true, "handle": "shadowStyle", "value": null }, { "description": "The relighting mode. Preserve hue and saturation when product color accuracy matters.", "jsonSchema": { "type": "string", "enum": [ "ai.auto", "ai.preserve-hue-and-saturation" ], "description": "The relighting mode. Preserve hue and saturation when product color accuracy matters." }, "nullable": true, "handle": "lightingMode", "value": null }, { "description": "The class of text to remove. This can change product details and requires human review.", "jsonSchema": { "type": "string", "enum": [ "ai.artificial", "ai.natural", "ai.all" ], "description": "The class of text to remove. This can change product details and requires human review." }, "nullable": true, "handle": "textRemovalMode", "value": null }, { "description": "The product-specific AI beautification mode. This can alter the subject and requires human review.", "jsonSchema": { "type": "string", "enum": [ "ai.auto", "ai.food", "ai.car" ], "description": "The product-specific AI beautification mode. This can alter the subject and requires human review." }, "nullable": true, "handle": "beautifyMode", "value": null }, { "description": "A fixed seed for producing similar beautification results. Requires beautifyMode.", "jsonSchema": { "type": "integer", "exclusiveMinimum": 0, "description": "A fixed seed for producing similar beautification results. Requires beautifyMode." }, "nullable": true, "handle": "beautifySeed", "value": null }, { "description": "A colored outline drawn around the detected product subject.", "jsonSchema": { "type": "object", "properties": { "color": { "type": "string", "minLength": 1, "description": "A hexadecimal color without a leading hash or a supported color name." }, "width": { "type": "number", "minimum": 0, "maximum": 0.1, "description": "The outline width as a ratio of the result image size." }, "blurRadius": { "type": "number", "minimum": 0, "maximum": 0.025, "description": "The outline blur radius as a ratio of the result image size." } }, "required": [ "color" ], "additionalProperties": false, "description": "A colored outline drawn around the detected product subject." }, "nullable": true, "handle": "outline", "value": null }, { "description": "Output canvas sizing and subject positioning controls.", "jsonSchema": { "type": "object", "properties": { "width": { "type": "integer", "exclusiveMinimum": 0, "description": "The output canvas width in pixels. Provide height with this field." }, "height": { "type": "integer", "exclusiveMinimum": 0, "description": "The output canvas height in pixels. Provide width with this field." }, "padding": { "type": "number", "minimum": 0, "exclusiveMaximum": 0.5, "description": "The fractional padding on every side of the subject, from 0 up to but excluding 0.5." }, "scaling": { "type": "string", "enum": [ "fit", "fill" ], "description": "Whether the subject should fit or fill the available canvas." }, "horizontalAlignment": { "type": "string", "enum": [ "left", "center", "right" ], "description": "The horizontal subject alignment." }, "verticalAlignment": { "type": "string", "enum": [ "top", "center", "bottom" ], "description": "The vertical subject alignment." } }, "additionalProperties": false, "description": "Output canvas sizing and subject positioning controls." }, "nullable": true, "handle": "canvas", "value": null }, { "description": "The encoded format of the edited result image.", "jsonSchema": { "type": "string", "enum": [ "png", "jpeg", "webp" ], "description": "The encoded format of the edited result image." }, "nullable": true, "handle": "outputFormat", "value": null }, { "description": "The output pixel density in dots per inch.", "jsonSchema": { "type": "integer", "minimum": 72, "maximum": 1200, "description": "The output pixel density in dots per inch." }, "nullable": true, "handle": "outputDpi", "value": null } ], "outputs": [ { "description": "The public transit URL used to download the edited image.", "jsonSchema": { "type": "string", "format": "uri", "description": "The public transit URL used to download the edited image." }, "nullable": false, "handle": "resultUrl" }, { "description": "The generated filename stored in transit.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The generated filename stored in transit." }, "nullable": false, "handle": "fileName" }, { "description": "The MIME type detected from the edited image bytes.", "jsonSchema": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp" ], "description": "The MIME type detected from the edited image bytes." }, "nullable": false, "handle": "contentType" }, { "description": "The edited image size in bytes.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "The edited image size in bytes." }, "nullable": false, "handle": "contentLength" }, { "description": "Whether selected AI edits can alter product appearance or text and should be reviewed before publishing.", "jsonSchema": { "type": "boolean", "description": "Whether selected AI edits can alter product appearance or text and should be reviewed before publishing." }, "nullable": false, "handle": "humanReviewRecommended" } ], "name": "Remove the image background", "executor": { "kind": "connector", "action": "photoroom.edit_product_image" } } }, "n_41857a93a95b9ab9": { "inputs": { "url": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4f7d36cc3f849519", "output": "resultUrl" } ] }, "size": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4f7d36cc3f849519", "output": "contentLength" } ] }, "contentType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4f7d36cc3f849519", "output": "contentType" } ] } }, "name": "Read the complete PNG", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "format": "uri", "description": "The public transit URL used to download the edited image." }, "nullable": false, "handle": "url" }, { "jsonSchema": { "type": "integer", "minimum": 0, "description": "The edited image size in bytes." }, "nullable": false, "handle": "size" }, { "jsonSchema": { "type": "string", "enum": [ "image/png", "image/jpeg", "image/webp" ], "description": "The MIME type detected from the edited image bytes." }, "nullable": false, "handle": "contentType" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "Connector media upload content encoded as a Base64 string." }, "nullable": true, "handle": "contentBase64" } ], "name": "Read the complete PNG", "moduleId": "n_35e2e1e9aa70dfe9", "capabilities": [ { "kind": "http", "hosts": [ "cdn.example.com" ] } ] } }, "n_c081352b877c513d": { "inputs": { "name": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2daabc01298e17d9", "output": "name" } ] }, "mimeType": { "kind": "value", "value": "image/png" }, "parents": { "kind": "value", "value": [ "YOUR_OUTPUT_FOLDER_ID" ] }, "contentBase64": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_41857a93a95b9ab9", "output": "contentBase64" } ] } }, "name": "Save the PNG to Drive", "kind": "task", "task": { "inputs": [ { "description": "The name of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The name of the file." }, "nullable": true, "handle": "name", "value": null }, { "description": "The MIME type of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The MIME type of the file." }, "nullable": true, "handle": "mimeType", "value": null }, { "description": "A short description of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "A short description of the file." }, "nullable": true, "handle": "description", "value": null }, { "description": "A list of parent folder IDs to place the file in.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Schema for nonEmptyString." }, "minItems": 1, "description": "A list of parent folder IDs to place the file in." }, "nullable": true, "handle": "parents", "value": null }, { "description": "Whether the user has starred the file.", "jsonSchema": { "type": "boolean", "description": "Whether the user has starred the file." }, "nullable": true, "handle": "starred", "value": null }, { "description": "A collection of arbitrary key-value pairs which are private to the requesting app.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "A collection of arbitrary key-value pairs which are private to the requesting app." }, "nullable": true, "handle": "appProperties", "value": null }, { "description": "A collection of arbitrary key-value pairs which are visible to all apps.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "A collection of arbitrary key-value pairs which are visible to all apps." }, "nullable": true, "handle": "properties", "value": null }, { "description": "Connector media upload content encoded as a Base64 string.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Connector media upload content encoded as a Base64 string." }, "nullable": true, "handle": "contentBase64", "value": null }, { "description": "Connector text media upload content.", "jsonSchema": { "type": "string", "description": "Connector text media upload content." }, "nullable": true, "handle": "text", "value": null } ], "outputs": [ { "description": "The unique identifier of the file.", "jsonSchema": { "type": "string", "description": "The unique identifier of the file." }, "nullable": false, "handle": "id" }, { "description": "The name of the file.", "jsonSchema": { "type": "string", "description": "The name of the file." }, "nullable": false, "handle": "name" }, { "description": "The MIME type of the file.", "jsonSchema": { "type": "string", "description": "The MIME type of the file." }, "nullable": false, "handle": "mimeType" }, { "description": "A link for opening the file in a relevant Google editor or viewer in a browser.", "jsonSchema": { "type": [ "string", "null" ], "description": "A link for opening the file in a relevant Google editor or viewer in a browser." }, "nullable": true, "handle": "webViewLink" }, { "description": "The time at which the file was created (RFC 3339 date-time).", "jsonSchema": { "type": [ "string", "null" ], "description": "The time at which the file was created (RFC 3339 date-time)." }, "nullable": true, "handle": "createdTime" }, { "description": "The last time the file was modified by anyone (RFC 3339 date-time).", "jsonSchema": { "type": [ "string", "null" ], "description": "The last time the file was modified by anyone (RFC 3339 date-time)." }, "nullable": true, "handle": "modifiedTime" }, { "description": "The size of the file's content in bytes.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The size of the file's content in bytes." }, "nullable": true, "handle": "sizeBytes" }, { "description": "The ID of the shared drive the file belongs to.", "jsonSchema": { "type": [ "string", "null" ], "description": "The ID of the shared drive the file belongs to." }, "nullable": true, "handle": "driveId" }, { "description": "The IDs of the parent folders containing the file.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "The IDs of the parent folders containing the file." }, "nullable": true, "handle": "parents" }, { "description": "The owners of the file.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "displayName": { "type": [ "string", "null" ], "description": "The display name of the owner." }, "emailAddress": { "type": [ "string", "null" ], "description": "The email address of the owner." }, "permissionId": { "type": [ "string", "null" ], "description": "The permission ID of the owner." }, "photoLink": { "type": [ "string", "null" ], "description": "A link to the owner's profile photo." } }, "required": [ "displayName", "emailAddress", "permissionId", "photoLink" ], "additionalProperties": false, "description": "Schema for driveOwnerSchema." }, "description": "The owners of the file." }, "nullable": true, "handle": "owners" }, { "description": "Whether the file has been shared.", "jsonSchema": { "type": "boolean", "description": "Whether the file has been shared." }, "nullable": true, "handle": "shared" }, { "description": "Whether the user has starred the file.", "jsonSchema": { "type": "boolean", "description": "Whether the user has starred the file." }, "nullable": true, "handle": "starred" }, { "description": "Whether the file has been trashed.", "jsonSchema": { "type": "boolean", "description": "Whether the file has been trashed." }, "nullable": true, "handle": "trashed" }, { "description": "Whether the authenticated user owns the file.", "jsonSchema": { "type": "boolean", "description": "Whether the authenticated user owns the file." }, "nullable": true, "handle": "ownedByMe" }, { "description": "The projected Drive capabilities for the authenticated user.", "jsonSchema": { "type": "object", "properties": { "canShare": { "type": "boolean", "description": "Whether the authenticated user may modify sharing settings." } }, "required": [ "canShare" ], "additionalProperties": false, "description": "The projected Drive capabilities for the authenticated user." }, "nullable": true, "handle": "capabilities" } ], "name": "Save the PNG to Drive", "executor": { "kind": "connector", "action": "googledrive.files.create" } } }, "n_8768a8e1bb65eabb": { "name": "Saved images", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "count" } ], "outputMappings": { "count": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_fe8e1ef94d4210b8", "output": "count" } ] } } } }, "edges": [ { "source": "n_e9710568ad78ed9c", "target": "n_fe8e1ef94d4210b8" }, { "source": "n_fe8e1ef94d4210b8", "target": "n_f0d5211f6945ecaf" }, { "source": "n_f0d5211f6945ecaf", "target": "n_b2a452c8efc1eafc", "sourceHandle": "process" }, { "source": "n_b2a452c8efc1eafc", "target": "n_56dbb1c91c96b55d" }, { "source": "n_56dbb1c91c96b55d", "target": "n_3e6b49fe0619307c" }, { "source": "n_3e6b49fe0619307c", "target": "n_2daabc01298e17d9" }, { "source": "n_2daabc01298e17d9", "target": "n_c1678c3c4948bb56" }, { "source": "n_c1678c3c4948bb56", "target": "n_f9da817b9536f0f9" }, { "source": "n_f9da817b9536f0f9", "target": "n_4f7d36cc3f849519" }, { "source": "n_4f7d36cc3f849519", "target": "n_41857a93a95b9ab9" }, { "source": "n_41857a93a95b9ab9", "target": "n_c081352b877c513d" }, { "source": "n_c081352b877c513d", "target": "n_fe8e1ef94d4210b8" }, { "source": "n_f0d5211f6945ecaf", "target": "n_8768a8e1bb65eabb", "sourceHandle": "otherwise" } ] } }, "modules": { "n_a474d907ca8a1753": { "name": "Prepare the next image", "imports": [], "source": "export default function progress({events,previousState,uploadId,uploadName,uploadType}){\n if(!Array.isArray(events))throw new Error('Expected Drive event batch');let index=0,completed=[];\n if(previousState!=null){if(!Number.isInteger(previousState.index)||!Array.isArray(previousState.completed)||previousState.index<1||previousState.index>events.length||previousState.completed.length!==previousState.index-1)throw new Error('Invalid progress');if(typeof uploadId!=='string'||!uploadId||typeof uploadName!=='string'||uploadType!=='image/png')throw new Error('Drive did not confirm the PNG; inspect before replaying');index=previousState.index;completed=[...previousState.completed,{inputId:events[index-1].fileId,outputId:uploadId,name:uploadName}];}\n const event=events[index];if(!event)return{state:{index,completed},more:false,fileId:'none',count:completed.length};if(event.eventType!=='file_created'||event.itemType!=='file'||typeof event.fileId!=='string'||!event.fileId)throw new Error('Invalid Drive event');return{state:{index:index+1,completed},more:true,fileId:event.fileId,count:completed.length};\n}\n" }, "n_a2e53f05b5985bb2": { "name": "Prepare the Drive metadata request", "imports": [], "source": "export default function endpoint({fileId}){if(typeof fileId!=='string'||!fileId)throw new Error('Missing Drive file ID');return{endpoint:'/files/'+encodeURIComponent(fileId)};}\n" }, "n_ffc4625b119f1899": { "name": "Prepare the image URL", "imports": [], "source": "export default function inputFile({file,expectedId,metadata,statusCode}){if(file?.fileId!==expectedId||typeof file.name!=='string'||typeof file.transitUrl!=='string'||!file.transitUrl.startsWith('https://')||statusCode!==200||metadata?.id!==expectedId||typeof metadata.originalFilename!=='string')throw new Error('Drive download or original filename not confirmed');return{url:file.transitUrl,name:'BG-Removed-'+metadata.originalFilename.split('.').slice(0,-1).join('.')+'.png'};}\n" }, "n_0cf86379318d6def": { "name": "Choose size and background", "imports": [], "source": "export default function options({metadata,keepInputSize,width,height,padding}){const w=keepInputSize?metadata?.width:width,h=keepInputSize?metadata?.height:height;if(!Number.isSafeInteger(w)||w<1||!Number.isSafeInteger(h)||h<1||typeof padding!=='number'||padding<0||padding>=.5)throw new Error('Invalid image size or edit settings');return{canvas:{width:w,height:h,padding}};}\n" }, "n_35e2e1e9aa70dfe9": { "name": "Read the complete PNG", "imports": [], "source": "import{Buffer}from'node:buffer';export default async function imageBytes({url,size,contentType},context){if(contentType!=='image/png'||!Number.isSafeInteger(size)||size<1||typeof url!=='string'||!url.startsWith('https://'))throw new Error('Photoroom did not return a PNG');const response=await context.fetch(url,{method:'GET'});if(!response.ok)throw new Error('PNG download failed');const b=new Uint8Array(await response.arrayBuffer());if(b.length!==size)throw new Error('Incomplete PNG');return{contentBase64:Buffer.from(b).toString('base64')};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }