Skip to content

Extend Support for custom SaveImage nodes within SaveImageExtraOutput #2218

@HaydenReeve

Description

@HaydenReeve

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions