/ComfyUI-ImageMagick

this extension implements custom nodes that integreated ImageMagick into ComfyUI

Primary LanguagePython

ComfyUI ImageMagick

ComfyUI ImageMagick is an extension implements custom nodes that integrated ImageMagick into ComfyUI.

ImageMagick is an extremely powerful image processing tool, and you can even think of it as a command-line version of "Photoshop". This Custom Nodes plugin allows you to integrate ImageMagick into your ComfyUI workflow.

overall

Installation

First, install ImageMagick 7.x on your local and ensure that you can run the 'magick' command in the command line.

Then, just like installing other ComfyUI plugins, run 'git clone' in the custom_nodes directory.

How to use

This plugin implements a custom node ImageMagick.

In the command line, theoretically, you can add unlimited image inputs and parameters.

In the current version of this plugin, the node allows up to 3 image inputs and 6 parameters.

If you find this number insufficient, please open an issue to inform me.

Why did I think of doing this?

Initially, it was because I generated black and white line art in stable diffusion, and then I wanted to turn the line art into transparent backgrounds. Of course, I could do this in Photoshop, but isn't there a faster way? That's when I discovered ImageMagick.

With just two commands in ImageMagick, you can achieve this:

  • magick input.png -threshold 70% -negate mask.png
  • magick input.png mask.png -alpha off -compose CopyOpacity -composite output.png

By adjusting the threshold, you can control the intensity of the line art.

Then, I thought, why not directly generate transparent line art in ComfyUI? That led to the idea of integrating ImageMagick into ComfyUI.

Examples

Here, I provide two workflows, mainly to implement the above two commands in ComfyUI:

  1. workflows1.xml overall
  2. workflows2.xml overall

And output: overall overall

It must be said that ImageMagick can achieve more powerful functionalities, and for specific usage, please refer to the ImageMagick official documentation.

Credit

  • ImageMagick - ImageMagickĀ® is a free, open-source software suite, used for editing and manipulating digital images.
  • ComfyUI - A powerful and modular stable diffusion GUI.

My extensions for ComfyUI

My extensions for stable diffusion webui

  • 3D Model/pose loader A custom extension for AUTOMATIC1111/stable-diffusion-webui that allows you to load your local 3D model/animation inside webui, or edit pose as well, then send screenshot to txt2img or img2img as your ControlNet's reference image.
  • Canvas Editor A custom extension for AUTOMATIC1111/stable-diffusion-webui that integrated a full capability canvas editor which you can use layer, text, image, elements and so on, then send to ControlNet, basing on Polotno.
  • StableStudio Adapter A custom extension for AUTOMATIC1111/stable-diffusion-webui to extend rest APIs to do some local operations, using in StableStudio.
  • Txt/Img to 3D Model A custom extension for sd-webui that allow you to generate 3D model from txt or image, basing on OpenAI Shap-E.
  • 3D Editor A custom extension for sd-webui that with 3D modeling features (add/edit basic elements, load your custom model, modify scene and so on), then send screenshot to txt2img or img2img as your ControlNet's reference image, basing on ThreeJS editor.