API Reference
Image generate background

Image generate background

Action GenerateBackgrounds

Introduction

This interface is used to generate a background to an image.

Request

Parameter NameTypeDescriptionRequired
ActionStringThe corresponding API command name, the current API is GenerateBackgrounds
PublicKeyStringUser's public key, can be obtained from User Center (opens in a new tab)
SignatureStringUser signature generated based on public key and API command, see Signature
request_uuidStringRequest uuid, randomly generated using uuid generation method, used for troubleshooting
MainModelModelGenerate Image Main Model,default: PICPIK General
SubModelList[]ModelGenerate Image Sub Model
PositivePrompts[]StringPositive Prompts
NegativePrompts[]StringNegative Prompts
TranslatePromptsBoolTranslate other language to English, default value: true
BackgroundImage2ImageBackgroundImageParamgraph parameters
TransparentForegroundTransparentForegroundItem foreground image parameters。
SeedIntRandom seed number (-1~2147483647), default value: -1
WidthIntWidth (64~2560), default value: foreground image size
HeightIntHeight (64~2560), default value: foreground image size
UseMainModelVAEBoolWhether to use the VAE that comes with the main model, default value: false
BatchSizeIntBatch image size (1~16), default value: 1
ImageList[]StringBase64 list of reference images List

Model

Parameter NameTypeDescriptionRequired
ModelCodeStringModel Code
InferenceParamsInferenceParamInference Params

InferenceParam

Parameter NameTypeDescriptionRequired
StepsIntSteps(6~100),default: 10
LoraWeightFloatLora weight (only valid when the model is lora),default: 1

BackgroundImageParam

Parameter NameTypeDescriptionRequired
ImageIndexIntThe image is indexed in ImageList, starting from 0
ReferStrengthFloatReference strength (0~1) Default value: 0.3
ResizeModeStringScaling mode, reference values: JustResize, CropAndResize, ResizeAndFill, default value: ResizeAndFill
DeepFusionBoolDeep fusion of background style. Enabling this option will increase the usage of API points (6 points/million pixels/step/image), default value: false

TransparentForeground

Parameter NameTypeDescriptionRequired
ImageIndexIntThe foreground image of the item, fill in the index of the image in the ImageList. Starting from 0, the background content outside the item needs to be a transparent PNG image.
ResizeModeStringZoom mode, reference values: JustResize, CropAndResize, ResizeAndFill, default value: ResizeAndFill

Note:

  1. The image format must be a png image with a transparent channel.

Request Example

{
	"Action": "GenerateBackgrounds",
	"PublicKey": "ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
	"Signature": "a44f6dc64600d7580211c50e4e8e2ebfe07123c6",
	"request_uuid": "5ae03609-451b-44d7-a351-c72904df881b",
	"MainModel": {
		"InferenceParams": {
			"Steps": 10
		},
		"ModelCode": "PICPIK General"
	},
	"BackgroundImage2Image": {
	    "ImageIndex": 1,
	    "ReferStrength": 0.3,
	    "ResizeMode": "ResizeAndFill",
	},
	"NegativePrompts": [],
	"PositivePrompts": ["blue sky","white cloud"],
	"TranslatePrompts": false,
	"TransparentImageIndexList": [0],
	"ImageList": [
		"data:image/jpeg;base64,img1",
		"data:image/jpeg;base64,img2"
	]
}

Response

Parameter NameTypeDescriptionRequired
RetCodeIntReturn status code, 0 for successful return, non-zero for failure
ActionStringOperation command name
MessageStringReturn error message, provide detailed description when RetCode is non-zero
request_uuidStringReturns the requested uuid
TaskUIDStringTask UID List, used to query task details and get results

Response Example

{
	"Action": "GenerateBackgrounds",
	"RetCode": 0,
	"Message": "",
	"request_uuid": "5ae03609-451b-44d7-a351-c72904df881b",
	"TaskUID": "ckt3uqacrh4miq8mr9lgg"
}