-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Overview
I would like to see a small change to the SaveImageExtraOutput class to allow for easier extension of the SaveImage functionality, such as Node S&R, as well as DateTime formatting per run.
ComfyUI_frontend/src/extensions/core/saveImageExtraOutput.ts
Lines 7 to 12 in 8f5aa1f
app.registerExtension({ | |
name: 'Comfy.SaveImageExtraOutput', | |
async beforeRegisterNodeDef(nodeType, nodeData, app) { | |
if (nodeData.name === 'SaveImage' || nodeData.name === 'SaveAnimatedWEBP') { | |
const onNodeCreated = nodeType.prototype.onNodeCreated | |
// When the SaveImage node is created we want to override the serialization of the output name widget to run our S&R |
Proposal
There might be a few better ways to increase the versatility and useability than my suggestion here, but I think it acts as an improvement in a stop-gap term until something more sustainable might be thought up.
Simply instead of
nodeData.name === 'SaveImage'
We use
nodeData.name.includes('SaveImage')
This allows for custom nodes to extend using the SaveImage
terminology, such as SaveImageAsWebp
or SaveImageAnimated
, or CustomSaveImage
.
I find this approach to be simple without adding too much overhead burdon to the system.
Testing
I've done some initial testing myself and it seems to work quite well. I now have a SaveImageToGrid
node properly working as intended and substituting my DateTime string as expected.
I'm in the process of putting up a PR with this tiny change, but I thought before I did that I should put through a general issue and prompt some discussion first.
┆Issue is synchronized with this Notion page by Unito