Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Was Node Suite Image Save is not transpiled #19

Open
lingondricka2 opened this issue Feb 1, 2024 · 7 comments
Open

Was Node Suite Image Save is not transpiled #19

lingondricka2 opened this issue Feb 1, 2024 · 7 comments
Labels
enhancement New feature or request pending Pending ComfyUI or custom node changes transpiler

Comments

@lingondricka2
Copy link
Contributor

lingondricka2 commented Feb 1, 2024

workflow (79).json

Not transpiled, also when I added the "was node suite image save" to my script manually and ran the script it embedded the whole script to the image and not the workflow.

ImageSave(
        image,             # images: Image,
        path,                # output_path: str = '[time(%Y-%m-%d)]',
        'ComfyUI',       #filename_prefix: str = 'ComfyUI',
        '_',                    #filename_delimiter: str = '_',
        4,                      #filename_number_padding: int = 4,
        'false',               #filename_number_start: ImageSave.filename_number_start = 'false',
        'webp',             #extension: ImageSave.extension = 'png',
        80,                    #quality: int = 100,
        'true',                 #lossless_webp: ImageSave.lossless_webp = 'false',
        'false',               #overwrite_mode: ImageSave.overwrite_mode = 'false',
        'false',               #show_history: ImageSave.show_history = 'false',
        'true',               #show_history_by_prefix: ImageSave.show_history_by_prefix = 'true',
        'true',               #embed_workflow: ImageSave.embed_workflow = 'true',
        'true',               #show_previews: ImageSave.show_previews = 'true'
        )
@Chaoses-Ib Chaoses-Ib added enhancement New feature or request transpiler labels Feb 1, 2024
@Chaoses-Ib
Copy link
Owner

Every output node will be transpiled with its own script. The problem is, the hook is only triggered when the metadata is written to a png file. Other formats, like webp, will not triggerd it. It works this way because the transpiler doens't know which node may save images.

I'm not sure what you are using the transpiler for. Using it in the web UI is designed to be used to generate a human-reable format of the workflow. If you want to convert workflows to scripts to use in code, then the CLI is probably better. I've also made a simply GUI for it, but not uploaded. If you want a GUI instead of a CLI, tell me, I'll polish it and upload.

@Chaoses-Ib
Copy link
Owner

As for the "workflow", it's an internal format used by the web UI (Differences from ComfyUI's web UI). The server only needs "prompt". So the runtime doesn't use or generate workflows in the web UI's internal format. However, you can drag and drop the image generated by the runtime to the web UI, and it'll convert it to the internal format. Can you let me know why would you need it?

By the way, you can turn off saving the script source by load(save_script_source=False). Though the compact version of the script is still saved, as it's equivalent to the "prompt" and doesn't save any more info.

@lingondricka2
Copy link
Contributor Author

Thank you for your help, I was unclear, the workflow is not loaded when I drag and drop the webp file, but It is loaded with a png file, with or without load(save_script_source=False). (The workflow is loaded when I drag and drop the webp file generated from the web UI)

Using a webp file over a png is not terrible important for me and I realize this might be a bit of an edge case, so you can close this issue if you want.

@Chaoses-Ib
Copy link
Owner

I dug a bit and found that this is a bug of the node itself: https://github.com/WASasquatch/was-node-suite-comfyui/blob/33534f2e48682ddcf580436ea39cffc7027cbb89/WAS_Node_Suite.py#L7227-L7238. It saves the prompt in Prompt, but the web UI only supports prompt. But workflow and Workflow are all supported in the web UI, and it's commented with "Support loading workflows from that webp custom node". I don't know why WAS not make them compatible with the web UI and why it's patched in the web UI instead of WAS. But anyway, a small PR to ComfyUI can fix this.

@Chaoses-Ib
Copy link
Owner

comfyanonymous/ComfyUI#2707. Hope it will be merged soon. Or you can modify app.js as the PR does.

@lingondricka2
Copy link
Contributor Author

lingondricka2 commented Feb 2, 2024

It was merged and I updated ComfyUI, checked app.js for the change. Still does not work. Can't upload webp to github, so here is link https://drive.google.com/file/d/1IxlsA5OMxaHD0f3sYbrwExV-hxhMDqWl/view?usp=sharing

The embedding looks a bit weird, it starts with Workflow: NUL Prompt :{"CheckpointLoaderSimple.0": {"inputs": {"ckpt_name": "xl\\turbovisionxlSuperFastXLBasedOnNew_alphaV0101Bakedvae.safetensors"},...

A webp generated from the web UI looks like:
Workflow:{"last_node_id": 144, "last_link_id": 264, "nodes": [{"id": 70, "type": "CLIPTextEncode", ...

@Chaoses-Ib
Copy link
Owner

Oh, I didn't notice that there is another bug in WAS Image Save: it will save Workflow regardless of whether it is available. And if Workflow exists, the web UI will use it instead of Prompt even if it's NUL. This one is surely a bug of the node itself and shouldn't be patched in ComfyUI. I've created a issue in WAS: WASasquatch/was-node-suite-comfyui#340.

@Chaoses-Ib Chaoses-Ib added the pending Pending ComfyUI or custom node changes label Feb 10, 2024
Chaoses-Ib added a commit that referenced this issue Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pending Pending ComfyUI or custom node changes transpiler
Projects
None yet
Development

No branches or pull requests

2 participants