diff --git a/ard_4crop_latent.py b/ard_4crop_latent.py index 0b2be46..4795d01 100644 --- a/ard_4crop_latent.py +++ b/ard_4crop_latent.py @@ -5,7 +5,10 @@ @description: CPlus Combine Images combines 4 or 2 images into 1 and outputs an image and a mask. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -13,7 +16,6 @@ # contributers found here https://github.com/comfyanonymous/ComfyUI # thus all code here is released to the user as per the GPL V3.0 terms. - import folder_paths MAX_RESOLUTION = 8192 diff --git a/ard_4img_combine.py b/ard_4img_combine.py index d86bb20..168889f 100644 --- a/ard_4img_combine.py +++ b/ard_4img_combine.py @@ -5,7 +5,10 @@ @description: CPlus Combine Images combines 4 or 2 images into 1 and outputs an image and a mask. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_4latent_upscale.py b/ard_4latent_upscale.py index 069b532..ab9e88b 100644 --- a/ard_4latent_upscale.py +++ b/ard_4latent_upscale.py @@ -5,7 +5,10 @@ @description: ARD 4 Latent Upscale upscales 4 latent images by a set factor. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_4vae_decode.py b/ard_4vae_decode.py index c8e897a..c4db8cc 100644 --- a/ard_4vae_decode.py +++ b/ard_4vae_decode.py @@ -5,7 +5,10 @@ @description: ARD 4VAE Decode takes in 4 latent images and decodes them. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_add_text_box.py b/ard_add_text_box.py index 9293980..c7d31be 100644 --- a/ard_add_text_box.py +++ b/ard_add_text_box.py @@ -5,7 +5,10 @@ @description: add text box takes input text adds it to contained text and outputs a string of text. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -22,7 +25,7 @@ class ARD_ADD_TEXT_BOX: "required": { "input_text": ("STRING", {"tooltip": "connect previous text as input"}), "add_text": ("STRING", {"multiline": True, "dynamicPrompts": True, "tooltip": "enter your text here to be added to previous input text"}), - }, + } } RETURN_NAMES = ("string_out",) @@ -36,6 +39,6 @@ class ARD_ADD_TEXT_BOX: if isinstance(input_text, str) and isinstance(add_text, str): text = input_text + ' ' + add_text else: - text = str(input_text) + str(add_text) + text = str(input_text) print(f"ARD ADD TEXT: ERROR: one of the inputs is not text or string:\n{text}") return (text,) \ No newline at end of file diff --git a/ard_basic_load_image.py b/ard_basic_load_image.py index 1369b99..0f09c1b 100644 --- a/ard_basic_load_image.py +++ b/ard_basic_load_image.py @@ -5,7 +5,10 @@ @description: ARD Basic Load Image: adds width and height to the output of the default load image """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_control_box.py b/ard_control_box.py index 2671771..249734e 100644 --- a/ard_control_box.py +++ b/ard_control_box.py @@ -5,7 +5,10 @@ @description: ARD control box is designed to gather workflow variables into 1 node. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -62,7 +65,7 @@ class ARD_CONTROL_BOX: CATEGORY = "Ardenius" DESCRIPTION = "ARD control box is designed to gather workflow variables into 1 node" - # my_code_start + def ard_control_box(self, cfg, steps, denoise, scaler, seed, positive_prompt, negative_prompt, model, vae, width, height, latent_width, latent_height, latent_batch_size, divx): remainder = width % divx diff --git a/ard_counter.py b/ard_counter.py index 904dc36..369e673 100644 --- a/ard_counter.py +++ b/ard_counter.py @@ -4,13 +4,12 @@ @nickname: Ardenius @description: ARD Counter: keeps increasing x_count by x_input until x_total is reached then resets to zero """ -import os.path - -from ard_save_image import ard_data - # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -18,8 +17,10 @@ from ard_save_image import ard_data # contributers found here https://github.com/comfyanonymous/ComfyUI # thus all code here is released to the user as per the GPL V3.0 terms. +import os.path import ard_lib - +current_directory = os.path.dirname(os.path.abspath(__file__)) +ard_data = os.path.join(current_directory, "ard_data") class ARD_COUNTER: # def __init__(self): @@ -29,8 +30,8 @@ class ARD_COUNTER: return { "required": { "x_input": ("FLOAT", {"default": 1, "tooltip": "input a float that increments to be added to x_count"}), - "x_total": ("FLOAT", {"default": 1, "tooltip": "total a float when reached resets x_count to zeros"}), - }, + "x_total": ("FLOAT", {"default": 1, "tooltip": "total a float when reached resets x_count to zeros"}) + } } RETURN_NAMES = ("x_count_int", "x_count_float",) @@ -59,7 +60,7 @@ class ARD_COUNTER: x_count_int = 0 x_count_float = 0.0 - ard_counter_json = "/ard_data/ard_counter.json" + ard_counter_json = os.path.join(ard_data, "ard_counter.json") counter_dict = {} x_input_old = 0.0 x_total_old = 0.0 @@ -76,18 +77,26 @@ class ARD_COUNTER: x_count_float_old = counter_dict.get("x_count_float", 0.0) x_count_int_old = counter_dict.get("x_count_int_old", 0) - if x_input is not None and x_input > 0.0 and x_input > x_input_old: - x_count_float = x_count_float_old + (x_input - x_input_old) + if x_input is not None and 0.0 < x_input < x_total: + x_count_float = x_count_float_old + x_input + if x_count_float >= x_total: + x_input = 0.0 + x_total = 0.0 x_count_float = 0.0 + x_count_int = 0 + + print(f'\n***\nard_counter reset to zero:\nx count float: {x_count_float}\nx input: {x_input}\nx total: {x_total}\n***\n') + x_count_int = int(x_count_float) counter_dict["x_input"] = x_input counter_dict["x_total"] = x_total counter_dict["x_count_int"] = x_count_int counter_dict["x_count_float"] = x_count_float ard_lib.save_dict_to_json(counter_dict, ard_counter_json) + print(f'\n***\nx count float: {x_count_float}\nx input: {x_input}\nx total: {x_total}\n***\n') else: x_count_float = x_count_float_old x_count_int = x_count_int_old - return (x_count_int, x_count_float) \ No newline at end of file + return (x_count_int, x_count_float) diff --git a/ard_dual_prompt.py b/ard_dual_prompt.py index b36891a..5aaff40 100644 --- a/ard_dual_prompt.py +++ b/ard_dual_prompt.py @@ -5,7 +5,10 @@ @description: ARD Dual Prompt can be used for positive and negative prompts converts string text input to conditioning prompt. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_empty_latent_image.py b/ard_empty_latent_image.py index 69e916f..e221496 100644 --- a/ard_empty_latent_image.py +++ b/ard_empty_latent_image.py @@ -5,7 +5,10 @@ @description: ARD Empty latent image allows for entering divisor for image dimension """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -29,7 +32,7 @@ class ARD_Empty_Latent_Image: "width": ("INT", {"default": 1024, "min": 16, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The width of the latent images in pixels."}), "height": ("INT", {"default": 1024, "min": 16, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The height of the latent images in pixels."}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."}), - "divx": ("INT", {"default": 8, "min": 8, "max": 4096, "step": 8, "tooltip": "image dimensions divx."}), + "divx": ("INT", {"default": 8, "min": 8, "max": 4096, "step": 8, "tooltip": "image dimensions divx."}) } } RETURN_TYPES = ("LATENT",) diff --git a/ard_float.py b/ard_float.py index ff27180..4bc37a0 100644 --- a/ard_float.py +++ b/ard_float.py @@ -5,7 +5,10 @@ @description: ARD float: outputs an float number """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_integer.py b/ard_integer.py index 224da8b..efbb482 100644 --- a/ard_integer.py +++ b/ard_integer.py @@ -5,7 +5,10 @@ @description: ARD integer: outputs an integer number """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -20,8 +23,8 @@ class ARD_INTEGER: def INPUT_TYPES(cls): return { "required": { - "Ix": ("INT", {"default": 1, "tooltip": "input an integer or float"}), - }, + "Ix": ("INT", {"default": 1, "tooltip": "input an integer or float"}) + } } RETURN_NAMES = ("integer",) diff --git a/ard_integer_to_float.py b/ard_integer_to_float.py index 7bdef4b..0d87769 100644 --- a/ard_integer_to_float.py +++ b/ard_integer_to_float.py @@ -5,7 +5,10 @@ @description: ARD integer: outputs an integer number """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_lib.py b/ard_lib.py index 61f338e..24aa008 100644 --- a/ard_lib.py +++ b/ard_lib.py @@ -5,14 +5,25 @@ import inspect import importlib.util import hashlib +# licensed under General Public License v3.0 all rights reserved © 2024 +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius +# ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) +# 📸 Change the mood ! by Visiting my AI Image Gallery +# 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) +# below code is based upon ComfyUI code licensed under General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.txt by +# contributers found here https://github.com/comfyanonymous/ComfyUI +# thus all code here is released to the user as per the GPL V3.0 terms. def save_dict_to_json(data_dict, json_file_path): try: - with open(json_file_path, 'w') as file: - json.dump(data_dict, file, indent=4) + with open(json_file_path, 'w') as jfile: + json.dump(data_dict, jfile, indent=4) # print(f"\nJSON file created and data saved successfully to: \n{json_file_path}") - except: - pass + except Exception as e: + print(f"could not save: {e}") def read_dict_from_json(json_file_path): diff --git a/ard_load_image.py b/ard_load_image.py index 7db35b4..293ff15 100644 --- a/ard_load_image.py +++ b/ard_load_image.py @@ -4,12 +4,17 @@ @nickname: Ardenius @description: ARD Load Image outputs images generation information when saved through ARD Save Image or ComfyUI. """ -# code marked between # my_code_start and # my_code_end is licensed all rights reserved © 2024 +# licensed under General Public License v3.0 all rights reserved © 2024 # Owner initials: AMAA # nickname: Ardenius # email: ardenius7@gmail.com # website: https://ko-fi.com/ardenius -# part or all of this software is licensed under GPL v3 https://www.gnu.org/licenses/gpl-3.0.txt by ComfyUI https://github.com/comfyanonymous/ComfyUI +# ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) +# 📸 Change the mood ! by Visiting my AI Image Gallery +# 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) +# below code is based upon ComfyUI code licensed under General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.txt by +# contributers found here https://github.com/comfyanonymous/ComfyUI +# thus all code here is released to the user as per the GPL V3.0 terms. import os import folder_paths diff --git a/ard_math.py b/ard_math.py index 93ffd29..c1c015e 100644 --- a/ard_math.py +++ b/ard_math.py @@ -5,7 +5,10 @@ @description: ARD Integer variable """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_position.py b/ard_position.py index 985824a..a3f7e95 100644 --- a/ard_position.py +++ b/ard_position.py @@ -5,7 +5,10 @@ @description: ARD Position positions images in latent space correctly. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_prompt_travel.py b/ard_prompt_travel.py index 315ef98..83941e8 100644 --- a/ard_prompt_travel.py +++ b/ard_prompt_travel.py @@ -5,7 +5,10 @@ @description: ARD Prompt Travel: add text box takes input text adds it to contained text and outputs a string of text. controlled through counter. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -20,27 +23,27 @@ class ARD_PROMPT_TRAVEL: def INPUT_TYPES(cls): return { "required": { - "input_text": ("STRING", {"tooltip": "connect previous text as input"}), - "add_text": ("STRING", {"multiline": True, "dynamicPrompts": True, "tooltip": "enter your text here to be added to previous input text"}), + "input_text": ("STRING", {"default": "", "tooltip": "connect previous text as input"}), + "add_text": ("STRING", {"multiline": True, "dynamicPrompts": True, "default": "", "tooltip": "enter your text here to be added to previous input text"}) }, "optional": { - "xcount": ("FLOAT",), - "from_xcount": ("FLOAT", {"default": 0.0}), - "to_xcount": ("FLOAT", {"default": 0.0}), + "xcount": ("FLOAT", {"default": 1.0, "step": 1.0}), + "from_xcount": ("FLOAT", {"default": 1.0, "step": 1.0}), + "to_xcount": ("FLOAT", {"default": 1.0, "step": 1.0}) } } - RETURN_NAMES = ("string_out",) - RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("string_out","xcount") + RETURN_TYPES = ("STRING", "FLOAT",) FUNCTION = "ard_prompt_travel" CATEGORY = "Ardenius" DESCRIPTION = "ARD Prompt Travel: add text box takes input text adds it to contained text and outputs a string of text. controlled through counter" def ard_prompt_travel(self, input_text, add_text, xcount, from_xcount, to_xcount): - if isinstance(input_text, str) and isinstance(add_text, str) and (from_xcount <= xcount <= to_xcount): + if isinstance(input_text, str) and isinstance(add_text, str) and (from_xcount <= xcount <= to_xcount) and xcount > 0.0: text = input_text + ' ' + add_text - print(f"ARD Prompt Travel: {xcount}: executing prompt:\n{text}") + print(f"\n***\nARD Prompt Travel: {xcount}: executing prompt:\n{text}\n***\n") else: text = str(input_text) - return (text,) \ No newline at end of file + return (text, xcount) \ No newline at end of file diff --git a/ard_remainder.py b/ard_remainder.py index fb6c43b..a0de1d8 100644 --- a/ard_remainder.py +++ b/ard_remainder.py @@ -5,7 +5,10 @@ @description: ARD remainder: adds to Ix to make it divisible by Dx and outputs the integer """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) diff --git a/ard_resize.py b/ard_resize.py index e618cab..8591958 100644 --- a/ard_resize.py +++ b/ard_resize.py @@ -4,12 +4,17 @@ @nickname: Ardenius @description: ARD Resize aids in image resizing. """ -# code marked between # my_code_start and # my_code_end is licensed all rights reserved © 2024 +# licensed under General Public License v3.0 all rights reserved © 2024 # Owner initials: AMAA # nickname: Ardenius # email: ardenius7@gmail.com # website: https://ko-fi.com/ardenius -# part or all of this software is licensed under GPL v3 https://www.gnu.org/licenses/gpl-3.0.txt by ComfyUI https://github.com/comfyanonymous/ComfyUI +# ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) +# 📸 Change the mood ! by Visiting my AI Image Gallery +# 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) +# below code is based upon ComfyUI code licensed under General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.txt by +# contributers found here https://github.com/comfyanonymous/ComfyUI +# thus all code here is released to the user as per the GPL V3.0 terms. import folder_paths @@ -22,16 +27,17 @@ class ARD_RESIZE: @classmethod def INPUT_TYPES(s): - return {"required": - { - "width": ("INT", {"default": 1024, "step": 8}), - "height": ("INT", {"default": 1024, "step": 8}), - "upscale_multiplier": ("FLOAT", {"default": 1.0}), + return {"required": { + "img_width": ("INT", {"default": 1024, "step": 8}), + "img_height": ("INT", {"default": 1024, "step": 8}), + "max_width": ("INT", {"default": 1024, "step": 8}), + "max_height": ("INT", {"default": 1024, "step": 8}), + "upscale_multiplier": ("FLOAT", {"default": 1.0}) }, "optional": { - "width_ratio": ("INT", {"default": 1}), - "height_ratio": ("INT", {"default": 1}), - }, + "width_ratio": ("INT", {"default": 16}), + "height_ratio": ("INT", {"default": 9}) + } } RETURN_NAMES = ("latent_width", "latent_height", "x_pos", "y_pos") @@ -44,14 +50,14 @@ class ARD_RESIZE: CATEGORY = "Ardenius" DESCRIPTION = "ARD Resize aids in image resizing" # my_code_start - def ard_resize(self, width, height, width_ratio, height_ratio, upscale_multiplier): + def ard_resize(self, img_width, img_height, max_width, max_height, upscale_multiplier, width_ratio, height_ratio): if width_ratio >= height_ratio: - std_dimension = width + std_dimension = max_width std_ratio = height_ratio/width_ratio width_latent = int(std_dimension * upscale_multiplier) height_latent = int(std_dimension * std_ratio * upscale_multiplier) else: - std_dimension = height + std_dimension = max_height std_ratio = width_ratio/height_ratio height_latent = int(std_dimension * upscale_multiplier) width_latent = int(std_dimension * std_ratio * upscale_multiplier) @@ -62,15 +68,15 @@ class ARD_RESIZE: remainder = height_latent % 8 height_latent = height_latent + remainder - if width_latent > width: - x_pos = int((width_latent - width)/2) + if width_latent > img_width: + x_pos = int((width_latent - img_width)/2) else: - x_pos = 0 + x_pos = - int((img_width - width_latent)/2) - if height_latent > height: - y_pos = int((height_latent - height)/2) + if height_latent > img_height: + y_pos = int((height_latent - img_height)/2) else: - y_pos = 0 + y_pos = - int((img_height - height_latent)/2) return (width_latent, height_latent, x_pos, y_pos) # my_code_end diff --git a/ard_save_image.py b/ard_save_image.py index ebc2607..b36d9f5 100644 --- a/ard_save_image.py +++ b/ard_save_image.py @@ -5,7 +5,10 @@ @description: ARD Save Image is a ComfyUI work organizer which allows you to save images in custom directories and meta tag them with custom information. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -23,7 +26,8 @@ import folder_paths from comfy.cli_args import args import ard_lib -ard_data = "/ard_data" +current_directory = os.path.dirname(os.path.abspath(__file__)) +ard_data = os.path.join(current_directory, "/ard_data") class ARD_SAVE_IMAGE: diff --git a/ard_text_box.py b/ard_text_box.py index cc27bdb..cc6d9c2 100644 --- a/ard_text_box.py +++ b/ard_text_box.py @@ -5,7 +5,10 @@ @description: text box takes input text outputs a string of text. """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) @@ -21,16 +24,17 @@ class ARD_TEXT_BOX: return { "required": { "text": ("STRING", {"multiline": True, "dynamicPrompts": True, "tooltip": "enter your text here"}), - }, + "ard_counter": ("FLOAT",{"default": 1.0}) + } } - RETURN_NAMES = ("string_out",) - RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("string_out", "ard_counter") + RETURN_TYPES = ("STRING", "FLOAT") FUNCTION = "ard_text_box" CATEGORY = "Ardenius" DESCRIPTION = "text box takes input text outputs a string of text." - def ard_text_box(self, text): + def ard_text_box(self, text, ard_counter): - return (text,) \ No newline at end of file + return (text, ard_counter) \ No newline at end of file diff --git a/ard_upscale_latent_by.py b/ard_upscale_latent_by.py index 517a79f..17f92f8 100644 --- a/ard_upscale_latent_by.py +++ b/ard_upscale_latent_by.py @@ -5,13 +5,17 @@ @description: ARD upscale latent by: adds width and height output and up scales a latent input by a float factor that is more accurate than original node """ # licensed under General Public License v3.0 all rights reserved © 2024 -# ( author initials AMAA Nickname Ardenius contact information ardenius7@gmail.com attribution link https://ko-fi.com/ardenius ) +# Owner initials: AMAA +# nickname: Ardenius +# email: ardenius7@gmail.com +# website: https://ko-fi.com/ardenius # ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) # 📸 Change the mood ! by Visiting my AI Image Gallery # 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) # below code is based upon ComfyUI code licensed under General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.txt by # contributers found here https://github.com/comfyanonymous/ComfyUI # thus all code here is released to the user as per the GPL V3.0 terms. + import comfy diff --git a/ard_xy_scripts.py b/ard_xy_scripts.py index b0f514d..d109bc0 100644 --- a/ard_xy_scripts.py +++ b/ard_xy_scripts.py @@ -4,17 +4,23 @@ @nickname: Ardenius @description: ARD XY Tester is for testing images using a range of steps, cfg, or denoise in ComfyUI. """ -# code marked between # my_code_start and # my_code_end is licensed all rights reserved © 2024 +# licensed under General Public License v3.0 all rights reserved © 2024 # Owner initials: AMAA # nickname: Ardenius # email: ardenius7@gmail.com # website: https://ko-fi.com/ardenius -# part or all of this software is licensed under GPL v3 https://www.gnu.org/licenses/gpl-3.0.txt by ComfyUI https://github.com/comfyanonymous/ComfyUI +# ➡️ follow me at https://ko-fi.com/ardenius in the top right corner (follow) +# 📸 Change the mood ! by Visiting my AI Image Gallery +# 🏆 Support me by getting Premium Members only Perks (Premium SD Models, ComfyUI custom nodes, and more to come) +# below code is based upon ComfyUI code licensed under General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.txt by +# contributers found here https://github.com/comfyanonymous/ComfyUI +# thus all code here is released to the user as per the GPL V3.0 terms. import os.path import folder_paths import json +import ard_lib MAX_RESOLUTION = 8192 @@ -30,7 +36,7 @@ class ARD_XY_SCRIPTS: def INPUT_TYPES(s): return {"required": { "activate": (["On", "Off"], {"default": "On"}), - "trigger_seed": ("INT", {"default": 1234}), + "seed": ("INT", {"default": 1234567891, "min": 1, "max": 9999999999, "step": 1}), }, "optional": { "width": ("INT", {"default": 1024, "min": 64, "max": MAX_RESOLUTION, "step": 8}), @@ -57,7 +63,7 @@ class ARD_XY_SCRIPTS: CATEGORY = "Ardenius" DESCRIPTION = "ARD XY Tester is for testing images using a range of steps, cfg, or denoise in ComfyUI." # my_code_start - def ard_xy_scripts(self, activate, width, height, start_cfg, end_cfg, step_cfg, start_steps, end_steps, step_steps, start_denoise, end_denoise, step_denoise, trigger_seed): + def ard_xy_scripts(self, activate, width, height, start_cfg, end_cfg, step_cfg, start_steps, end_steps, step_steps, start_denoise, end_denoise, step_denoise, seed): if activate == 'On': xy_dict = {} @@ -72,19 +78,20 @@ class ARD_XY_SCRIPTS: xy_dict_in['xy_current'] = {"cfg": cfg, "steps": steps, "denoise": denoise} node_dir = os.path.join(os.getcwd(), "custom_nodes/ComfyUI-Ardenius") - json_file = os.path.join(node_dir, "data/xy_data.json") + json_file = os.path.join(node_dir, "ard_data/xy_data.json") if os.path.exists(json_file): - xy_dict = self.read_data(json_file) + xy_dict = ard_lib.read_dict_from_json(json_file) if xy_dict['xy_input'] != xy_dict_in['xy_input']: xy_dict['xy_input'] = xy_dict_in['xy_input'] cfg = xy_dict['xy_current']['cfg'] steps = xy_dict['xy_current']['steps'] denoise = xy_dict['xy_current']['denoise'] xy_dict = self.update_steps(xy_dict) - xy_dict = self.write_data(xy_dict, json_file) + ard_lib.save_dict_to_json(xy_dict, json_file) else: - xy_dict = self.write_data(xy_dict_in, json_file) + xy_dict = xy_dict_in + ard_lib.save_dict_to_json(xy_dict_in, json_file) cfg = xy_dict['xy_current']['cfg'] steps = xy_dict['xy_current']['steps'] denoise = xy_dict['xy_current']['denoise'] @@ -99,44 +106,27 @@ class ARD_XY_SCRIPTS: cfg = 8 steps = 20 denoise = 8 - print('\n---\nCPlus XY Script is off and set to defaults:\nsteps: 20\ncfg: 8\ndenoise: 1\n---\n') + print('\n---\nARD XY Script is off and set to defaults:\nsteps: 20\ncfg: 8\ndenoise: 1\n---\n') - return width, height, cfg, steps, denoise, trigger_seed + return width, height, cfg, steps, denoise, seed def update_steps(s, xy_dict): if int(xy_dict['xy_current']['steps']) < int(xy_dict['xy_input']['end_steps']): xy_dict['xy_current'].update({"steps": xy_dict['xy_current']['steps'] + xy_dict['xy_input']['step_steps']}) - print(f"\n---\nCPlus XY Script : executing step {xy_dict['xy_current']['steps']}\n---\n") + print(f"\n---\nARD XY Script : executing step {xy_dict['xy_current']['steps']}\n---\n") else: xy_dict['xy_current'].update({"steps": xy_dict['xy_input']['start_steps']}) if float(xy_dict['xy_current']['cfg']) < float(xy_dict['xy_input']['end_cfg']): xy_dict['xy_current'].update({"cfg": xy_dict['xy_current']['cfg'] + xy_dict['xy_input']['step_cfg']}) - print(f"\n---\nCPlus XY Script : executing cfg {xy_dict['xy_current']['cfg']}\n---\n") + print(f"\n---\nARD XY Script : executing cfg {xy_dict['xy_current']['cfg']}\n---\n") else: xy_dict['xy_current'].update({"steps": xy_dict['xy_input']['start_cfg']}) if float(xy_dict['xy_current']['denoise']) < float(xy_dict['xy_input']['end_denoise']): xy_dict['xy_current'].update({"denoise": xy_dict['xy_current']['denoise'] + xy_dict['xy_input']['step_denoise']}) - print(f"\n---\nCPlus XY Script : executing denoise {xy_dict['xy_current']['denoise']}\n---\n") + print(f"\n---\nARD XY Script : executing denoise {xy_dict['xy_current']['denoise']}\n---\n") else: xy_dict['xy_current'].update({"steps": xy_dict['xy_input']['start_denoise']}) return xy_dict - def write_data(s,data_dict, data_file): - with open(data_file, 'w') as wdf: - json_data = json.dumps(data_dict) - wdf.write(json_data) - data_dict = json.loads(json_data) - return data_dict - - def read_data(s,data_file): - if os.path.exists(data_file): - with open(data_file, 'r') as rdf: - json_data = json.load(rdf) - output_dict = json.loads(json_data) - return output_dict - else: - print(f'\n---\ndata file {data_file} not found\n---\n') - return None - # my_code_end diff --git a/node_list.json b/node_list.json index 3f94ac4..bfb5817 100644 --- a/node_list.json +++ b/node_list.json @@ -19,5 +19,7 @@ "ARD Resize": "allows for generating ai images with different aspect ratios", "ARD Counter": "keeps increasing x_count by x_input until x_total is reached then resets to zero", "ARD Basic Load Image": "adds width and height to the default load image node", - "ARD Prompt Travel": "add text box takes input text adds it to contained text and outputs a string of text. controlled through counter" + "ARD Prompt Travel": "add text box takes input text adds it to contained text and outputs a string of text. controlled through counter", + "ARD Seed": "adds float output to seed", + "ARD Float To Integer": "converts floats into integers" } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e90b399..a2fccae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ civitai +moviepy \ No newline at end of file