Patch an asset with an image.
Parameters
image: str
The input image as a data URL (example: “data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=”) or the asset ID (example: “asset_GTrL3mq4SXWyMxkOHRxlpw”)
Whether to allow the merged image to extend the size of the original (when x or y are negative or merged image is bigger)
Patch
import os
from scenario_sdk import Scenario
client = Scenario(
api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted
api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted
)
response = client.generate.patch(
image="image",
)
print(response.job){
"job": {
"createdAt": "createdAt",
"jobId": "jobId",
"jobType": "assets-download",
"metadata": {
"assetIds": [
"string"
],
"error": "error",
"flow": [
{
"id": "id",
"status": "failure",
"type": "custom-model",
"assets": [
{
"assetId": "assetId",
"url": "url"
}
],
"count": 0,
"dependsOn": [
"string"
],
"includeOutputsInWorkflowJob": true,
"inputs": [
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"items": [
[
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
]
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
],
"items": [
"string"
],
"iterationIndex": 0,
"jobId": "jobId",
"logic": {
"cases": [
{
"condition": "condition",
"value": "value"
}
],
"default": "default",
"transform": "transform"
},
"logicType": "if-else",
"loopBodyNodeIds": [
"string"
],
"loopNodeId": "loopNodeId",
"modelId": "modelId",
"output": {},
"workflowId": "workflowId"
}
],
"hint": "hint",
"input": {
"foo": "bar"
},
"output": {
"foo": "bar"
},
"outputModelId": "outputModelId",
"workflowId": "workflowId",
"workflowJobId": "workflowJobId"
},
"progress": 0,
"status": "canceled",
"statusHistory": [
{
"date": "date",
"status": "canceled"
}
],
"updatedAt": "updatedAt",
"authorId": "authorId",
"billing": {
"cuCost": 0,
"cuDiscount": 0
},
"ownerId": "ownerId"
},
"asset": {
"id": "id",
"authorId": "authorId",
"collectionIds": [
"string"
],
"createdAt": "createdAt",
"editCapabilities": [
"DETECTION"
],
"kind": "3d",
"metadata": {
"kind": "3d",
"type": "3d-texture",
"angular": 0,
"aspectRatio": "aspectRatio",
"backgroundOpacity": 0,
"baseModelId": "baseModelId",
"bbox": [
0,
0,
0,
0
],
"betterQuality": true,
"cannyStructureImage": "cannyStructureImage",
"clustering": true,
"colorCorrection": true,
"colorMode": "colorMode",
"colorPrecision": 0,
"concepts": [
{
"modelId": "modelId",
"scale": -2,
"modelEpoch": "modelEpoch"
}
],
"contours": [
[
[
[
0
]
]
]
],
"controlEnd": 0,
"copiedAt": "copiedAt",
"cornerThreshold": 0,
"creativity": 0,
"creativityDecay": 0,
"defaultParameters": true,
"depthFidelity": 0,
"depthImage": "depthImage",
"detailsLevel": -50,
"dilate": 0,
"factor": 0,
"filterSpeckle": 0,
"fractality": 0,
"geometryEnforcement": 0,
"guidance": 0,
"halfMode": true,
"hdr": 0,
"height": 0,
"highThreshold": 0,
"horizontalExpansionRatio": 1,
"image": "image",
"imageFidelity": 0,
"imageType": "seamfull",
"inferenceId": "inferenceId",
"inputFidelity": "high",
"inputLocation": "bottom",
"invert": true,
"keypointThreshold": 0,
"layerDifference": 0,
"lengthThreshold": 0,
"lockExpiresAt": "lockExpiresAt",
"lowThreshold": 0,
"mask": "mask",
"maxIterations": 0,
"maxThreshold": 0,
"minThreshold": 0,
"modality": "canny",
"mode": "mode",
"modelId": "modelId",
"modelType": "custom",
"name": "name",
"nbMasks": 0,
"negativePrompt": "negativePrompt",
"negativePromptStrength": 0,
"numInferenceSteps": 5,
"numOutputs": 1,
"originalAssetId": "originalAssetId",
"outputIndex": 0,
"overlapPercentage": 0,
"overrideEmbeddings": true,
"parentId": "parentId",
"parentJobId": "parentJobId",
"pathPrecision": 0,
"points": [
[
0
],
[
0
],
[
0
]
],
"polished": 0,
"preset": "preset",
"progressPercent": 0,
"prompt": "prompt",
"promptFidelity": 0,
"raised": 0,
"referenceImages": [
"string"
],
"refinementSteps": 0,
"removeBackground": true,
"resizeOption": 0.1,
"resultContours": true,
"resultImage": true,
"resultMask": true,
"rootParentId": "rootParentId",
"saveFlipbook": true,
"scalingFactor": 1,
"scheduler": "scheduler",
"seed": "seed",
"sharpen": true,
"shiny": 0,
"size": 0,
"sketch": true,
"sourceProjectId": "sourceProjectId",
"spliceThreshold": 0,
"strength": 0,
"structureFidelity": 0,
"structureImage": "structureImage",
"style": "3d-cartoon",
"styleFidelity": 0,
"styleImages": [
"string"
],
"styleImagesFidelity": 0,
"targetHeight": 0,
"targetWidth": 1024,
"text": "text",
"texture": "texture",
"thumbnail": {
"assetId": "assetId",
"url": "url"
},
"tileStyle": true,
"trainingImage": true,
"verticalExpansionRatio": 1,
"width": 1024
},
"mimeType": "mimeType",
"ownerId": "ownerId",
"privacy": "private",
"properties": {
"size": 0,
"animationFrameCount": 0,
"bitrate": 0,
"boneCount": 0,
"channels": 0,
"classification": "effect",
"codecName": "codecName",
"description": "description",
"dimensions": [
0,
0,
0
],
"duration": 0,
"faceCount": 0,
"format": "format",
"frameRate": 0,
"hasAnimations": true,
"hasNormals": true,
"hasSkeleton": true,
"hasUVs": true,
"height": 0,
"nbFrames": 0,
"sampleRate": 0,
"transcription": {
"text": "text"
},
"vertexCount": 0,
"width": 0
},
"source": "3d23d",
"status": "error",
"tags": [
"string"
],
"updatedAt": "updatedAt",
"url": "url",
"automaticCaptioning": "automaticCaptioning",
"description": "description",
"embedding": [
0
],
"firstFrame": {
"assetId": "assetId",
"url": "url"
},
"isHidden": true,
"lastFrame": {
"assetId": "assetId",
"url": "url"
},
"nsfw": [
"string"
],
"originalFileUrl": "originalFileUrl",
"outputIndex": 0,
"preview": {
"assetId": "assetId",
"url": "url"
},
"thumbnail": {
"assetId": "assetId",
"url": "url"
}
},
"creativeUnitsCost": 0,
"creativeUnitsDiscount": 0
}Returns Examples
{
"job": {
"createdAt": "createdAt",
"jobId": "jobId",
"jobType": "assets-download",
"metadata": {
"assetIds": [
"string"
],
"error": "error",
"flow": [
{
"id": "id",
"status": "failure",
"type": "custom-model",
"assets": [
{
"assetId": "assetId",
"url": "url"
}
],
"count": 0,
"dependsOn": [
"string"
],
"includeOutputsInWorkflowJob": true,
"inputs": [
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"items": [
[
{
"name": "name",
"type": "boolean",
"allowedValues": [
{}
],
"backgroundBehavior": "opaque",
"color": true,
"costImpact": true,
"default": {},
"description": "description",
"group": "group",
"hint": "hint",
"inputs": [
{
"foo": "bar"
}
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
]
],
"kind": "3d",
"label": "label",
"maskFrom": "maskFrom",
"max": 0,
"maxLength": 0,
"maxSize": 0,
"min": 0,
"minLength": 0,
"modelTypes": [
"custom"
],
"parent": true,
"placeholder": "placeholder",
"prompt": true,
"promptSpark": true,
"ref": {
"conditional": [
"string"
],
"equal": "equal",
"name": "name",
"node": "node"
},
"required": {
"always": true,
"conditionalValues": {},
"ifDefined": {},
"ifNotDefined": {}
},
"step": 1,
"value": {}
}
],
"items": [
"string"
],
"iterationIndex": 0,
"jobId": "jobId",
"logic": {
"cases": [
{
"condition": "condition",
"value": "value"
}
],
"default": "default",
"transform": "transform"
},
"logicType": "if-else",
"loopBodyNodeIds": [
"string"
],
"loopNodeId": "loopNodeId",
"modelId": "modelId",
"output": {},
"workflowId": "workflowId"
}
],
"hint": "hint",
"input": {
"foo": "bar"
},
"output": {
"foo": "bar"
},
"outputModelId": "outputModelId",
"workflowId": "workflowId",
"workflowJobId": "workflowJobId"
},
"progress": 0,
"status": "canceled",
"statusHistory": [
{
"date": "date",
"status": "canceled"
}
],
"updatedAt": "updatedAt",
"authorId": "authorId",
"billing": {
"cuCost": 0,
"cuDiscount": 0
},
"ownerId": "ownerId"
},
"asset": {
"id": "id",
"authorId": "authorId",
"collectionIds": [
"string"
],
"createdAt": "createdAt",
"editCapabilities": [
"DETECTION"
],
"kind": "3d",
"metadata": {
"kind": "3d",
"type": "3d-texture",
"angular": 0,
"aspectRatio": "aspectRatio",
"backgroundOpacity": 0,
"baseModelId": "baseModelId",
"bbox": [
0,
0,
0,
0
],
"betterQuality": true,
"cannyStructureImage": "cannyStructureImage",
"clustering": true,
"colorCorrection": true,
"colorMode": "colorMode",
"colorPrecision": 0,
"concepts": [
{
"modelId": "modelId",
"scale": -2,
"modelEpoch": "modelEpoch"
}
],
"contours": [
[
[
[
0
]
]
]
],
"controlEnd": 0,
"copiedAt": "copiedAt",
"cornerThreshold": 0,
"creativity": 0,
"creativityDecay": 0,
"defaultParameters": true,
"depthFidelity": 0,
"depthImage": "depthImage",
"detailsLevel": -50,
"dilate": 0,
"factor": 0,
"filterSpeckle": 0,
"fractality": 0,
"geometryEnforcement": 0,
"guidance": 0,
"halfMode": true,
"hdr": 0,
"height": 0,
"highThreshold": 0,
"horizontalExpansionRatio": 1,
"image": "image",
"imageFidelity": 0,
"imageType": "seamfull",
"inferenceId": "inferenceId",
"inputFidelity": "high",
"inputLocation": "bottom",
"invert": true,
"keypointThreshold": 0,
"layerDifference": 0,
"lengthThreshold": 0,
"lockExpiresAt": "lockExpiresAt",
"lowThreshold": 0,
"mask": "mask",
"maxIterations": 0,
"maxThreshold": 0,
"minThreshold": 0,
"modality": "canny",
"mode": "mode",
"modelId": "modelId",
"modelType": "custom",
"name": "name",
"nbMasks": 0,
"negativePrompt": "negativePrompt",
"negativePromptStrength": 0,
"numInferenceSteps": 5,
"numOutputs": 1,
"originalAssetId": "originalAssetId",
"outputIndex": 0,
"overlapPercentage": 0,
"overrideEmbeddings": true,
"parentId": "parentId",
"parentJobId": "parentJobId",
"pathPrecision": 0,
"points": [
[
0
],
[
0
],
[
0
]
],
"polished": 0,
"preset": "preset",
"progressPercent": 0,
"prompt": "prompt",
"promptFidelity": 0,
"raised": 0,
"referenceImages": [
"string"
],
"refinementSteps": 0,
"removeBackground": true,
"resizeOption": 0.1,
"resultContours": true,
"resultImage": true,
"resultMask": true,
"rootParentId": "rootParentId",
"saveFlipbook": true,
"scalingFactor": 1,
"scheduler": "scheduler",
"seed": "seed",
"sharpen": true,
"shiny": 0,
"size": 0,
"sketch": true,
"sourceProjectId": "sourceProjectId",
"spliceThreshold": 0,
"strength": 0,
"structureFidelity": 0,
"structureImage": "structureImage",
"style": "3d-cartoon",
"styleFidelity": 0,
"styleImages": [
"string"
],
"styleImagesFidelity": 0,
"targetHeight": 0,
"targetWidth": 1024,
"text": "text",
"texture": "texture",
"thumbnail": {
"assetId": "assetId",
"url": "url"
},
"tileStyle": true,
"trainingImage": true,
"verticalExpansionRatio": 1,
"width": 1024
},
"mimeType": "mimeType",
"ownerId": "ownerId",
"privacy": "private",
"properties": {
"size": 0,
"animationFrameCount": 0,
"bitrate": 0,
"boneCount": 0,
"channels": 0,
"classification": "effect",
"codecName": "codecName",
"description": "description",
"dimensions": [
0,
0,
0
],
"duration": 0,
"faceCount": 0,
"format": "format",
"frameRate": 0,
"hasAnimations": true,
"hasNormals": true,
"hasSkeleton": true,
"hasUVs": true,
"height": 0,
"nbFrames": 0,
"sampleRate": 0,
"transcription": {
"text": "text"
},
"vertexCount": 0,
"width": 0
},
"source": "3d23d",
"status": "error",
"tags": [
"string"
],
"updatedAt": "updatedAt",
"url": "url",
"automaticCaptioning": "automaticCaptioning",
"description": "description",
"embedding": [
0
],
"firstFrame": {
"assetId": "assetId",
"url": "url"
},
"isHidden": true,
"lastFrame": {
"assetId": "assetId",
"url": "url"
},
"nsfw": [
"string"
],
"originalFileUrl": "originalFileUrl",
"outputIndex": 0,
"preview": {
"assetId": "assetId",
"url": "url"
},
"thumbnail": {
"assetId": "assetId",
"url": "url"
}
},
"creativeUnitsCost": 0,
"creativeUnitsDiscount": 0
}