Pattern extraction
Action
GeneratePatternsFromImage
Introduction
This interface extracts the contents of an image within a specific boundary and converts it into a pattern through redrawing. It is commonly utilized to extract a tiling pattern from an object.
Request
Parameter Name | Type | Description | Required |
---|---|---|---|
Action | String | The corresponding API instruction name | ✓ |
PublicKey | String | User's public key, which can be obtained from the PICPIK User Center (opens in a new tab) | ✓ |
Signature | String | User's signature generated based on the public key and API instruction, see Signature for details | ✓ |
request_uuid | String | Request UUID, randomly generated by using the UUID generation method. This parameter can be utilized to manage the requests of your business and clients. |
Parameter Name | Type | Description | Required |
---|---|---|---|
MainModel | Model | Main model for generating images | ✓ |
SubModelList | []Model | The submodel list for generating images includes LoRA, Embedding, and HyperNetwork. | |
PositivePrompts | []String | Content description of what you want to appear in the image. | |
NegativePrompts | []String | Content description of what you do not want to appear in the image. | |
TranslatePrompts | Bool | Translate other languages to English, see support language list here. Default value: true | |
Seed | Int | The number of a seed (-1~2147483647), -1 represents a ramdom seed. Default value: -1 | |
Width | Int | Image width (64~2560). Default value: 1024 | |
Height | Int | Image height (64~2560). Default value: 1024 | |
BatchSize | Int | Batch size for generating images (1~16). Default value: 1 | |
UseMainModelVAE | Bool | Whether to use the codec that comes with the main model. Default value: false |
Parameter Name | Type | Description | Required |
---|---|---|---|
RawImage | Base64 | You need to extract the picture of the pattern, encoded in Base64 | ✓ |
Box | []Int | The selection boundary of the pattern needs to pass 4 numbers, which are x coordinate in the upper left corner, y coordinate in the upper left corner, x coordinate in the lower right corner, and y coordinate in the lower right corner | ✓ |
Tiling | Bool | Whether to generate tileable images, mainly used to generate stitching texture patterns. Default: false |
Intro to Complex Data Types
Model
Field Name | Type | Description | Required |
---|---|---|---|
Name | String | Model name | |
ModelCode | String | Model code | ✓ |
IsOfficial | Bool | Is official model or not | |
TriggerWordList | []String | Trigger word list, only available with LoRA model | |
InferenceParams | InferenceParams | Inference parameters |
Request Example
{
"Action": "GeneratePatternsFromImage",
"MainModel": {
"ModelCode" : "PICPIK General"
},
"PositivePrompts": ["a apple"],
"RawImage": "imagebase64",
"Box": [10, 10, 200, 200],
"Tiling": false
}
Response
Field Name | Type | Description | Required |
---|---|---|---|
RetCode | Int | Return status code: 0 indicates a successful return, while non-zero indicates a failure | ✓ |
Action | String | Instruction name | ✓ |
Message | String | The error message is returned when RetCode is non-zero, providing a detailed description | |
request_uuid | String | Returns the UUID that was included in the request |
Parameter Name | Type | Description | Required |
---|---|---|---|
TaskUID | String | Task UID, used to query task details and get results | ✓ |
Response Example
{
"Action": "GeneratePatternsFromImage",
"RetCode": 0,
"Message": "",
"request_uuid": "8482d350-04f9-421b-817b-1d98b3a4dcfa",
"TaskUID": "cktlm6lrh4xxx8ng9nf0"
}