API Reference
Redraw Masked Pixels

Redraw Masked Pixels

Action ModifyMaskedPixels

Introduction

This interface is used to redraw masked pixels of the image.

Request

Parameter NameTypeDescriptionRequired
ActionStringThe corresponding API command name, the current API is ModifyMaskedPixels
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
SubModelList[]ModelGenerate Image Sub Model
PositivePrompts[]StringPositive Prompts
NegativePrompts[]StringNegative Prompts
TranslatePromptsBoolTranslate other language to English, default value: true
Image2ImageImage2ImageParamgraph parameters
MaskedMaskedRedraw area mask parameters
SeedIntRandom seed number (-1~2147483647), default value: -1
WidthIntWidth (64~2560), default value: 1024
HeightIntHeight (64~2560), default value: 1024
BatchSizeIntBatch image size (1~16), default value: 1
UseMainModelVAEBoolWhether to use the VAE that comes with the main model, default value: false
ImageAndMaskList[]StringBase64 list of reference images and masks

Model

Parameter NameTypeDescriptionRequired
ModelCodeStringModel Code
InferenceParamsInferenceParamInference Params

InferenceParam

Parameter NameTypeDescriptionRequired
StepsIntSteps(6~100),default: 10
SamplerStringSampler,Refer toSupport Samplers,default: Euler
ClipSkipIntPrompt word to skip levels(1~12),default: 1
CFGScaleFloatPrompt word guidance level(1~30),default: 7.5
LoraWeightFloatLora weight (only valid when the model is lora),default: 1

Note: If the model used is the official PICPIK model, the default value shall be the default value returned by ListModels.

Image2ImageParam

Parameter NameTypeDescriptionRequired
ImageIndexIntThe image is indexed in ImageAndMaskList, starting from 0
ReferStrengthFloatReference strength (0~1) Default value: 0.5
ResizeModeStringScaling mode, reference values: JustResize, CropAndResize, ResizeAndFill, default value: ResizeAndFill

Masked

Parameter NameTypeDescriptionRequired
ImageIndexIntThe image is indexed in ImageAndMaskList, starting from 0
MaskIndexIntThe mask is indexed in ImageAndMaskList. The mask is Base64 of black and white mask, where the white part is the redrawn part. Masks can be drawn independently or obtained through the Remove-Background or Content Extraction APIs.
ReferStrengthFloatReference intensity (0~2), default value: 1
InvertMaskBoolInvert the mask, default value: false
MaskBlurIntMask edge blur radius (0~64), default value: 12
PromptsMoreImportantBoolStrengthen the impact of prompts, default value: false

Request Example

{
	"Action": "ModifyMaskedPixels",
	"PublicKey": "ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
	"Signature": "a44f6dc64600d7580211c50e4e8e2ebfe07123c6",
	"TranslatePrompts": true,
	"request_uuid": "5ae03609-451b-44d7-a351-c72904df881b",
	"MainModel": {
		"InferenceParams": {
			"Steps": 10
		},
		"ModelCode": "PICPIK General"
	},
	"Masked": {
		"ImageIndex": 0,
		"MaskIndex": 1
	},
	"NegativePrompts": [],
	"PositivePrompts": [],
 
	"ImageAndMaskList": [
		"data:image/jpeg;base64,img1",
		"data:image/jpeg;base64,img2"
	]
}
💡

Tip
In a real development environment, you can pass a Model object returned by the MainModels parameter of the ListModels interface directly into the MainModel parameter of this interface. Take Python as an example:

# Assume a variable "sdModels" as the JSON data returned by the interface "ListModels"
{
    "MainModel": sdModels["MainModels"]["PICPIK General"],
}

Parameters include model data such as SubModelList can also be set by utilizing similar skills.

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, used to query task details and get results

Response Example

{
	"Action": "ModifyMaskedPixels",
	"RetCode": 0,
	"Message": "",
	"request_uuid": "432c57d3-102b-4817-9e98-28054b33db8e",
	"TaskUID": "ckt3uqlrh4miq8mr9lgg"
}