Files
Nourepide-ComfyUI-Allor/README.MD
T
2023-06-08 05:03:39 +03:00

24 KiB
Raw Blame History

logo

This image from start to end was done in ComfyUI. How?
  1. Install plugin.
  2. Load fonts Overlock SC and Merienda.
  3. Put OverlockSC-Regular.ttf and Merienda-Regular.ttf in to fonts folder.
  4. Load RealESRNet_x4plus.pth and put in to models/upscale folder.
  5. Load AOM3A1B_orangemixs.safetensors and put in to models/chekpoints folder.
  6. Load orangemix.vae.pt and put in to models/vae folder.
  7. Drag-and-drop this image to ComfyUI or load JSON.
  8. Press the Queue Promt button.

About Allor:

  • Allor is a plugin for ComfyUI with an emphasis on transparency and performance.
  • All modules support transparency, multi-image and are easy to use.
  • One of the main features is the ability to combine several images of different sizes.
  • Almost all functionality is implemented in tensor space without transformation into an image, where possible. This allows you to achieve an incredible speed of work, in some places the speed increases from 1-2 seconds to 4-6 milliseconds.

Installation:

  1. cd custom_nodes
  2. git clone https://github.com/Nourepide/ComfyUI-Allor.git comfyui_allor
  3. cd comfyui_allor
  4. pip install -r requirements.txt
  5. You can also create fonts folder in comfy_extras or just start ComfyUI and folder will create automatically.

Updating:

  1. cd custom_nodes/comfyui_allor or cd custom_nodes/{name of ComfyUI Allor folder}
  2. git checkout main && git pull

Modules:

Click on Details to open/close the drop-down menu with all modules.

Details:

Alpha chanel

alpha_chanel

Helpers for work with alpha chanel in exiting images.

Nodes:

By Mask

alpha_chanel_by_mask

Applies transparency to the image using a mask.

Params:
  • method -
    • default - Standard mask overlay.
    • invert - Inverted mask overlay.

As Mask

alpha_chanel_as_mask

Get alpha chanel from first image and returns it as mask.

Params:
  • method -
    • default - Standard mask overlay.
    • invert - Inverted mask overlay.

Restore

alpha_chanel_restore

Add alpha dimension to images. Or restore if it already exists.

Params:
  • method -
    • default - Apply adding new alpha chanel or restore chanel values to max if it already exists.
    • only_add - Only add new alpha chanel if it does not exist.
    • only_restore - Only restore alpha chanel values to max if it already exists.

Remove

alpha_chanel_remove

Completely remove alpha chanel from image (Convert RGBA to RGB).


Image Container

image_container

Creating blank images of fixed or inherited size.

Nodes:

All

  • [red, green, blue] [0 - 255] - Color of the container in RGB.
  • alpha [0.0 - 1.0] - Transparency of the container.

Default

Create an empty container.

Params:
  • [width, height] [1 - *] - Size of a new container.

Inheritance Add

Get images size and create a container with adding value to this size.

Params:
  • add_[width, height] [0 - *] - The value that will then be added to the size of the container.

Inheritance Scale

Get images size and create a container with scaling this size.

Params:
  • scale_[width, height] [0.0 - *] - Scale factor that will then be change the size of the container.

Inheritance Max

Get max width and max height from images_a and images_b and create a new container with this size.

Inheritance Sum

Get width and/or height from images_a and images_b and create a new container with a sum this size.

PS:

The first letter i in the word Inheritance is barely noticeable. But in the end, I decided to leave it as it is. At first, I thought to replace this word with the word Extended, but one would think that this node expands the incoming images by adding size to it, and does not create a new image inheriting size from the incoming images.


Image Composite

image_composite

Allows you to place one image on top of another.

Nodes:

All

  • background - The placement order of images in the container.
  • method - The method of connecting images makes sense only when 2 or more images are passed to the input.
Methods:
Inputs - [a1, a2, a3] and [b1, b2, b3].
Outputs -
    pair: [a1, b1], [a2, b2], [a3, b3]
    matrix: [a1, b1], [a1, b2], [a1, b3]
            [a2, b1], [a2, b2], [a2, b3]
            [a3, b1], [a3, b2], [a3, b3]

image_composite_methods

Absolute

Use it for pixel-perfect images compositing.

Params:
  • images_[a, b]_x [0 - *] - Images horizontal position. [left -> right].
  • images_[a, b]_y [0 - *] - Images vertical position. [top -> bottom].
  • container_[width, height] [0 - *] - Container size. If 0, then the container will be with the maximum width and height of the images.

AbsoluteByContainer

Use it for pixel-perfect images compositing. The size of the container is taken from the outside.

Params:
  • container - Image "donor". Its size will determine the size of the compositing space.
  • images_[a, b]_x [0 - *] - Images horizontal position. [left -> right].
  • images_[a, b]_y [0 - *] - Images vertical position. [top -> bottom].

Relative

Use it for percentage images compositing.

Params:
  • images_[a, b]_x [0.0 - 1.0] - First images horizontal offset. [left edge -> right edge].
  • images_[a, b]_y [0.0 - 1.0] - First images vertical offset. [top edge -> bottom edge].
  • container_size_type
    • max - Maximum of width and height from images_a and images_b.
    • sum - Sum of width and height from images_a and images_b.
    • sum_[width, height] - Sum of width or height from images_a and images_b.

How it works.

  • Images in relative mode cannot go beyond the edges of the container.
  • In horizontal [0.0 - images is located on the left of the container], [1.0 - on right of container].
  • In vertical [0.0 - images is located on the top of the container], [1.0 - on bottom of container].
  • In all cases, [0.5] means that the images will be in the center.

RelativeByContainer

Use it for percentage images compositing. The size of the container is taken from the outside.

Params:
  • container - Image "donor". Its size will determine the size of the compositing space. Can't be smaller then max size of with or height images_[a, b].
  • images_[a, b]_x [0.0 - 1.0] - First images horizontal offset. [left edge -> right edge].
  • images_[a, b]_y [0.0 - 1.0] - First images vertical offset. [top edge -> bottom edge].

Image Segmentation

image_segmentation

Removes background from image.

Nodes:

All

  • alpha_matting [boolean] - Alpha matting is a post-processing step that can be used to improve the quality of the output.
  • alpha_matting_foreground_threshold [0 - 250] - Trimap foreground threshold.
  • alpha_matting_background_threshold [0 - 250] - Trimap background threshold.
  • alpha_matting_erode_size [0 - *] - How far will the transparency spread from the original mask.
  • post_process_mask [boolean] - Post-processing mask, makes it rougher.

Default

Allows you to select a model with pre-specified settings.:

Params:

Custom

Allows you to select a model from the onnx folder and specify the parameters yourself.

Params:
  • model [*.onnx] - Your model in ComfyUI/models/onnx folder.
  • mean [0.0 - 1.0] - Clarifying value.
  • std [0.0 - 1.0] - The divisor of the final value. I recommend leaving it at 1.0.
  • size [0 - *] - Title size. Different models support different sizes. Or their multiple values [512 -> 1024 -> 2048...]. If the size does not match the desired one, you will see a notification in the console.

Custom Advanced

Allows you to select a model from the onnx folder and finely specify the parameters yourself.

Params:
  • model [*.onnx] - Your model in ComfyUI/models/onnx folder.
  • mean_r [0.0 - 1.0] - Clarifying value. Red chanel.
  • mean_g [0.0 - 1.0] - Clarifying value. Green chanel.
  • mean_b [0.0 - 1.0] - Clarifying value. Blue chanel.
  • std_r [0.0 - 1.0] - The divisor of the final value. Red chanel.
  • std_g [0.0 - 1.0] - The divisor of the final value. Green chanel.
  • std_b [0.0 - 1.0] - The divisor of the final value. Blue chanel.
  • width [0 - *] - Width of title size.
  • height [0 - *] - Height of title size.

Some models support non-standard title size. For example [w:1024 - h:2048].

PS:

Made on rembg. The solution of some problems may be dependent on the rembg developer.


ImageText

image_text

Creating text as image.

Fonts should be contained in ComfyUI/comfy_extras/fonts.

You also can change the fonts folder in config.

Nodes:

Default

image_text_default

Create an image with text.

Params:
  • text - Your input. Shouldn't be empty.
  • font [*.otf, *.ttf] - Font from ComfyUI/comfy_extras/fonts folder.
  • size [1 - *] - Font size in SP. Warning!: It's not PX size of the container. The size of the container is calculated using a variety of parameters. Example: o and j will have different height and exactly different size compared to 树.
  • [red, green, blue] [0 - 255] - Color of the text in RGB.
  • alpha [0.0 - 1.0] - Transparency of the text.
  • margin_x [0 - *] - Horizontal offset.
  • margin_y [0 - *] - Vertical offset.

Outlined

image_text_outlined

Create an image with outlined text.

Params:
  • outline_size [0 - *] - Outline size in PX.
  • outline_[red, green, blue] [0 - 255] - Color of the outline in RGB.

ImageDraw

image_draw

Draw figures as image.

Nodes:

All

All nodes has ByContainer version.

  • SSAO [1 - 16] - Super Sampling Anti-Aliasing. The figure is drawn initially at a higher resolution, and then compressed to the specified resolution.
The difference of SSAA strength:

From left to right, x1, x2, x4, x8, x16. Image container size 256x256px.

SSAA

Arc

image_draw_arc

Draws an arc (a portion of a circle outline) between the start and end angles, inside the given bounding box.

Params:
  • [width, height] [1 - *] - Size of image container.
  • size [1 - *] - contour width.
  • start_[x, y] [0.0 - 1.0] - Start points to define the bounding box in percent of image container.
  • end_[x, y] [0.0 - 1.0] - End points to define the bounding box in percent of image container.
  • [start, end] [0 - 360] - Starting and ending angle, in degrees. Angles are measured from 3 o’clock, increasing clockwise.
  • [red, green, blue] [0 - 255] - Color of the figure in RGB.
  • alpha [0.0 - 1.0] - Transparency of the figure.

Chord

image_draw_chord

Same as Arc, but connects the end points with a straight line.

Params:
  • [width, height] [1 - *] - Size of image container.
  • size [1 - *] - contour width.
  • start_[x, y] [0.0 - 1.0] - Start points to define the bounding box in percent of image container.
  • end_[x, y] [0.0 - 1.0] - End points to define the bounding box in percent of image container.
  • [start, end] [0 - 360] - Starting and ending angle, in degrees. Angles are measured from 3 o’clock, increasing clockwise.
  • [red, green, blue] [0 - 255] - Color of the figure in RGB.
  • alpha [0.0 - 1.0] - Transparency of the figure.

Ellipse

image_draw_ellipse

Draws an ellipse inside the given bounding box.

Params:
  • [width, height] [1 - *] - Size of image container.
  • start_[x, y] [0.0 - 1.0] - Start points to define the bounding box in percent of image container.
  • end_[x, y] [0.0 - 1.0] - End points to define the bounding box in percent of image container.
  • outline_size [0 - *] - Outline size in PX.
  • outline_[red, green, blue] [0 - 255] - Color of the outline in RGB.
  • outline_alpha [0.0 - 1.0] - Transparency of the outline.
  • fill_[red, green, blue] [0 - 255] - Color of the fill in RGB.
  • fill_alpha [0.0 - 1.0] - Transparency of the fill.

Line

image_draw_line

Draws a line between the coordinates.

Params:
  • [width, height] [1 - *] - Size of image container.
  • size [1 - *] - contour width.
  • start_[x, y] [0.0 - 1.0] - Starting point of line.
  • end_[x, y] [0.0 - 1.0] - Ending point of line.
  • [red, green, blue] [0 - 255] - Color of the line in RGB.
  • alpha [0.0 - 1.0] - Transparency of the line.

Pieslice

image_draw_pieslice

Same as Arc, but also draws straight lines between the end points and the center of the bounding box.

Params:
  • [width, height] [1 - *] - Size of image container.
  • start_[x, y] [0.0 - 1.0] - Start points to define the bounding box in percent of image container.
  • end_[x, y] [0.0 - 1.0] - End points to define the bounding box in percent of image container.
  • [start, end] [0 - 360] - Starting and ending angle, in degrees. Angles are measured from 3 o’clock, increasing clockwise.
  • outline_size [0 - *] - Outline size in PX.
  • outline_[red, green, blue] [0 - 255] - Color of the outline in RGB.
  • outline_alpha [0.0 - 1.0] - Transparency of the outline.
  • fill_[red, green, blue] [0 - 255] - Color of the fill in RGB.
  • fill_alpha [0.0 - 1.0] - Transparency of the fill.

Rectangle

image_draw_rectangle

Draws a rectangle.

Params:
  • [width, height] [1 - *] - Size of image container.
  • start_[x, y] [0.0 - 1.0] - Start points to define the bounding box in percent of image container.
  • end_[x, y] [0.0 - 1.0] - End points to define the bounding box in percent of image container.
  • outline_size [0 - *] - Outline size in PX.
  • outline_[red, green, blue] [0 - 255] - Color of the outline in RGB.
  • outline_alpha [0.0 - 1.0] - Transparency of the outline.
  • fill_[red, green, blue] [0 - 255] - Color of the fill in RGB.
  • fill_alpha [0.0 - 1.0] - Transparency of the fill.

Rectangle Rounded

image_draw_rectangle_rounded

Draws a rounded rectangle.

Params:
  • [width, height] [1 - *] - Size of image container.
  • start_[x, y] [0.0 - 1.0] - Start points to define the bounding box in percent of image container.
  • end_[x, y] [0.0 - 1.0] - End points to define the bounding box in percent of image container.
  • radius [0 -360] - Radius of the corners.
  • outline_size [0 - *] - Outline size in PX.
  • outline_[red, green, blue] [0 - 255] - Color of the outline in RGB.
  • outline_alpha [0.0 - 1.0] - Transparency of the outline.
  • fill_[red, green, blue] [0 - 255] - Color of the fill in RGB.
  • fill_alpha [0.0 - 1.0] - Transparency of the fill.
  • [top_left, top_right, bottom_right, bottom_left]_corner [boolean] - The ability to choose for which angle to apply the radius.

Polygon

image_draw_polygon

Draws a polygon.

Params:
  • size [1 - *] - Size of image.
  • sides [3 - *] - Sides of polygon.
  • rotation [0 - 360] - Apply an arbitrary rotation to the polygon in degree.
  • outline_size [0 - *] - Outline size in PX.
  • outline_[red, green, blue] [0 - 255] - Color of the outline in RGB.
  • outline_alpha [0.0 - 1.0] - Transparency of the outline.
  • fill_[red, green, blue] [0 - 255] - Color of the fill in RGB.
  • fill_alpha [0.0 - 1.0] - Transparency of the fill.

Image Filter

image_filter

Apply filters to images.

Nodes:

Warning Some changes are difficult to notice without detailed consideration.You can load this JSON and look at the changes in detail.

Smooth

image_draw_polygon

Anti-Aliasing of image artifacts.

SmoothMore

image_filter_smooth_more

Improved Anti-Aliasing of image artifacts.

Blur

image_filter_blur

Blurring the image.

BoxBlur

image_filter_box_blur

Blurring the image by box algorithm.

Params:
  • radius [0 - *] - blurring radius.

GaussianBlur

image_filter_gaussian_blur

Blurring the image by gaussian algorithm.

Params:
  • radius [0 - *] - blurring radius.

Contour

image_filter_contour

Find the contours of the image.

Detail

image_filter_detail

Image detailing.

EdgeEnhance

image_filter_edge_enhance

Clarity of the image boundaries.

EdgeEnhanceMore

image_filter_edge_enhance_more

Improved clarity of image boundaries.

Emboss

image_filter_emboss

Embossed image.

FindEdges

image_filter_find_edges

Identifies the boundaries of the image.

Sharpen

image_filter_sharpen

Sharpness improvement.

Rank

image_filter_rank

Rank filter sorts all pixels in a window of a given size.

Params:
  • size [0 - *] - The size of the core in PX.
  • rank [0 - *] - Which pixel value to choose.

Median

image_filter_median

Selects the average pixel value in a window of the specified size.

Params:
  • size [0 - *] - The size of the core in PX.

Min

image_filter_min

Selects the smallest pixel value in the window at the specified size.

Params:
  • size [0 - *] - The size of the core in PX.

Max

image_filter_max

Selects the largest pixel value in the window at the specified size.

Params:
  • size [0 - *] - The size of the core in PX.

Mode

image_filter_mode

Selects the most common pixel value in a field of the specified size.

Params:
  • size [0 - *] - The size of the core in PX.

Image Transform

image_transform

Transform your images.

Nodes:

Resize

image_transform_resize

Change size of images.

Params:

Absolute

  • [width, height] [1 - *] - New size of images.

Relative

  • scale_[width, height] [0.0 - 1.0] - New size of images.

Crop

image_transform_crop

Returns area from images.

Params:

Absolute

  • start_[x, y] [1 - *] - Start of rectangle point.
  • end_[x, y] [1 - *] - End of rectangle point.

Relative

  • start_[x, y] [0.0 - 1.0] - Start of rectangle point.
  • end_[x, y] [0.0 - 1.0] - End of rectangle point.

Crop Corners

image_transform_crop_corners

Round corners of your images.

Params:
  • radius [0 -360] - Radius of the corners.
  • [top_left, top_right, bottom_right, bottom_left]_corner [boolean] - The ability to choose for which angle to apply the radius.
  • SSAO [1 - 16] - Super Sampling Anti-Aliasing. The figure is drawn initially at a higher resolution, and then compressed to the specified resolution.

Rotate

image_transform_rotate

Rotate your images.

Params:
  • angle [0 -360] - Angle in degrees. Angles are measured from 3 o’clock, increasing clockwise.
  • expand [boolean] - If "true" when rotating, change the size of the image to fit into it.
  • SSAO [1 - 16] - Super Sampling Anti-Aliasing. The figure is drawn initially at a higher resolution, and then compressed to the specified resolution.

Transpose

image_transform_transpose

Transpose your images.


Clamp

clamp

Clamps help to control the "web" of nodes and improve readability.

Nodes:
  • ClipClamp
  • ClipVisionClamp
  • ClipVisionOutputClamp
  • ConditioningClamp
  • ControlNetClamp
  • GligenClamp
  • ImageClamp
  • LatentClamp
  • MaskClamp
  • ModelClamp
  • StyleModelClamp
  • UpscaleModelClamp
  • VaeClamp

Configuration:

You can configurate Allor with config.json.

  • fonts_folder_path - Array with a relative path to fonts folder, by default is ["comfy_extras", "fonts"]. (Converted to ComfyUI/comfy_extras/fonts for Unix and ComfyUI\comfy_extras\fonts for Windows).
  • modules - You can disable (or enable) modules at will. Nodes from disabled modules will not be loaded during the start of ComfyUI.
  • override - If the nested value is set to true, similar functionality from the original nodes is disabled.
    • postprocessing - Disable image/postprocessing nodes. (See ImageFilter module)
    • transform - Disable ImageScale and ImageInvert nodes. (See ImageTransform module)

Examples:

example

Ready to create your own masterpiece?

Just see how easy it is to do:

Warning Google Collab can't reproduce those examples.

Image Nodes
1 JSON
2 JSON