Hello,
I would like to use Generative fill in a Photoshop UXP plugin with batchPlay. Is it possible?
If it is, what is the right value for _obj in the batchPlay call? I have tried many variations, it was the last I tried:
const result = await batchPlay([{ _obj: “generateFill”, prompt: “”, useSelection: true }], { synchronousExecution: true, modalBehavior: “execute” });
My goal is to fill (by AI) the missing part of a background image, if it is smaller than the canvas.
Thank you for your help!
shuji
2
The answer is possible.
Here is an example code.
/**
* before executing this code, make a selection on a document
*/
const generativeFill = async () => {
const result = await batchPlay(
[
{
_obj: "syntheticFill",
_target: [
{
_ref: "document",
_enum: "ordinal",
_value: "targetEnum"
}
],
documentID: app.activeDocument.id,
layerID: app.activeDocument.activeLayers[0].id,
prompt: "A butterfly is stopping on his face", // text prompt
serviceID: "clio",
workflowType: {
_enum: "genWorkflow",
_value: "in_painting"
},
serviceOptionsList: {
clio: {
_obj: "clio",
gi_PROMPT: "A butterfly is stopping on his face",
gi_MODE: "tinp",
gi_SEED: -1,
gi_NUM_STEPS: -1,
gi_GUIDANCE: 6,
gi_SIMILARITY: 0,
gi_CROP: false,
gi_DILATE: false,
gi_CONTENT_PRESERVE: 0,
gi_ENABLE_PROMPT_FILTER: true,
dualCrop: true
}
},
serviceVersion: "clio3",// AI model clio3 means Firefly 3 model
/* in case of nano_banana
serviceVersion: "nano_banana"
*/
workflow_to_active_service_identifier_map: {
in_painting: "clio3",
generate_background: "clio3",
out_painting: "clio3",
generate_similar: "clio3",
text_to_image: "clio3",
instruct_edit: "clio3",
generativeUpscale: "clio_f16_async",
gen_harmonize: "clio3"
},
_options: {
dialogOptions: "dontDisplay"
}
}
],
{}
);
console.log(result);
}
1 Like