By the way, structured JSON prompts have another useful feature. Now we can put a whole series of actions(steps) into one prompt, making it like a single workflow.
For example, removing the background in one of my versions looks like this
1) Remove Background Ext:
{
"Task": "Create a high-quality transparent image by removing the background from a source image.",
"constraints": {
"preserve_subject_details": true,
"maintain_original_dimensions": true,
"clean_edges": true
},
"steps": [
{
"step_id": 1,
"name": "Generate High-Contrast Matte",
"instructions": "Take the input image. Accurately segment the main subject(s) from the background. Replace the entire background with a solid, pure white color (hex #FFFFFF). The subject must be perfectly preserved with no alterations. The output image dimensions must be identical to the input image. Output this intermediate image as 'white_matte'."
},
{
"step_id": 2,
"name": "Create Transparency from Matte",
"instructions": "Take the original input image and the 'white_matte' image from step 1. Use 'white_matte' as a pixel-perfect transparency mask for the original input image. Where 'white_matte' is pure white, the corresponding pixels of the original image must become fully transparent (alpha=0). Where 'white_matte' is not white, the original image pixels must be fully opaque (alpha=255). The anti-aliased (near-white) pixels along the subject's edge in 'white_matte' should be translated into corresponding levels of semi-transparency to ensure a smooth, clean edge. Output this as 'final_transparent_image'."
}
],
"Deliverables": {
"transparent_png": "final_transparent_image"
}
}

No comments:
Post a Comment
А что вы думаете по этому поводу?