API Reference
Redraw Masked Pixels

Redraw Masked Pixels

API ModifyMaskedPixels


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


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


Parameter NameTypeDescriptionRequired
ModelCodestringModel Code
InferenceParamsInferenceParamInference Params


Parameter NameTypeDescriptionRequired
StepsintSteps(6~100),default: 10
SamplerstringSampler,Refer toSupport Samplers,default: Euler
ClipSkipintPrompt word to skip levels(1~12),default: 1
CFGScalefloat64Prompt word guidance level(1~30),default: 7.5
LoraWeightfloat64Lora 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.


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


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": [

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.


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"