Skip to content

Commit

Permalink
verson 1.74
Browse files Browse the repository at this point in the history
  • Loading branch information
Suzie1 committed Jan 18, 2024
1 parent 54695a6 commit d6ff722
Show file tree
Hide file tree
Showing 13 changed files with 640 additions and 128 deletions.
9 changes: 9 additions & 0 deletions Patch_Notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# 🧩 Comfyroll Studio - Patch Notes

## v1.74 Jan 18, 2024
- changed CR Simple Image Compare to automatically resize the second image if the size is different
- added CR Aspect Ratio For Print
- added CR Seamless Checker
- added CR Select ISO Size

## v1.73.1 Jan 17, 2024
- fix for issue 104

## v1.73 Jan 17, 2024
- added CR String to Boolean
- updated CR Aspect Ratio Social Media, added more options
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Co-authored by Suzie1 and RockOfFire

Current version: 1.73
Current version: 1.74

# Wiki

Expand Down Expand Up @@ -40,7 +40,8 @@ __🔳 Aspect Ratio__
* CR SDXL Aspect Ratio
* CR SD1.5 Aspect Ratio
* CR Aspect Ratio Banners (new 18/12/2023)
* CR Aspect Ratio Social Media (new 15/1/2024)
* CR Aspect Ratio Social Media (new 15/1/2024)
* CR Aspect Ratio For Print (new 18/1/2024)

__📜 List Nodes__
* CR Text List (new 19/12/2023)
Expand Down Expand Up @@ -156,6 +157,7 @@ __👽 Graphics - Template__
* CR Simple Banner (new 18/12/2023)
* CR Simple Image Compare (new 18/12/2023)
* CR Thumbnail Preview (new 26/12/2023)
* CR Seamless Checker (new 18/1/2023)

__🌁 Graphics - Layout__
* CR Image Panel
Expand All @@ -166,6 +168,7 @@ __🌁 Graphics - Layout__
* CR Color Panel
* CR Simple Text Panel
* CR Overlay Transparent Image
* CR Select ISO Size (new 18/1/2023)

## 🎥 Animation

Expand Down
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
@author: Suzie1
@title: Comfyroll Studio
@nickname: Comfyroll Studio
@description: 170 custom nodes for artists, designers and animators.
@description: 175 custom nodes for artists, designers and animators.
"""

from .node_mappings import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS

print("------------------------------------------")
print("\033[34mComfyroll Studio v1.73 : \033[92m 170 Nodes Loaded\033[0m")
print("\033[34mComfyroll Studio v1.74 : \033[92m 175 Nodes Loaded\033[0m")
print("------------------------------------------")
print("** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md")
print("** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki")
Expand Down
42 changes: 41 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,44 @@
"cyan", "magenta", "orange", "purple", "pink", "brown", "gray",
"lightgray", "darkgray", "olive", "lime", "teal", "navy", "maroon",
"fuchsia", "aqua", "silver", "gold", "turquoise", "lavender",
"violet", "coral", "indigo"]
"violet", "coral", "indigo"]

iso_sizes = {
"A0 - 9933x14043": (9933, 14043),
"A1 - 7016x9933": (7016, 9933),
"A2 - 4960x7016": (4960, 7016),
"A3 - 3508x4960": (3508, 4960),
"A4 - 2480x3508": (2480, 3508),
"A5 - 1748x2480": (1748, 2480),
"A6 - 1240x1748": (1240, 1748),
"A7 - 874x1240": (874, 1240),
"A8 - 614x874": (614, 874),
"A9 - 437x614": (437, 614),
"A10 - 307x437": (307, 437),
"A11 - 213x307": (213, 307),
"A12 - 154x213": (154, 213),
"A13 - 106x154": (106, 154),
"B0 - 11811x16701": (11811, 16701),
"B1 - 8350x11811": (8350, 11811),
"B2 - 5906x8350": (5906, 8350),
"B3 - 4169x5906": (4169, 5906),
"B4 - 2953x4169": (2953, 4169),
"B5 - 2079x2953": (2079, 2953),
"B6 - 1476x2079": (1476, 2079),
"B7 - 1039x1476": (1039, 1476),
"B8 - 732x1039": (732, 1039),
"B9 - 520x732": (520, 732),
"B10 - 366x520": (366, 520),
"C0 - 10831x15319": (10831, 15319),
"C1 - 7654x10831": (7654, 10831),
"C2 - 5409x7654": (5409, 7654),
"C3 - 3827x5409": (3827, 5409),
"C4 - 2705x3827": (2705, 3827),
"C5 - 1913x2705": (1913, 2705),
"C6 - 1346x1913": (1346, 1913),
"C7 - 957x1346": (957, 1346),
"C8 - 673x957": (673, 957),
"C9 - 472x673": (472, 673),
"C10 - 331x472": (331, 472),
}

16 changes: 11 additions & 5 deletions node_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"CR SDXL Aspect Ratio": CR_SDXLAspectRatio,
"CR Aspect Ratio": CR_AspectRatio,
"CR Aspect Ratio Banners": CR_AspectRatioBanners,
"CR Aspect Ratio Social Media": CR_AspectRatioSocialMedia,
"CR Aspect Ratio Social Media": CR_AspectRatioSocialMedia,
"CR_Aspect Ratio For Print": CR_AspectRatioForPrint,
### Legacy Nodes
"CR Image Size": CR_ImageSize,
"CR Aspect Ratio SDXL": CR_AspectRatio_SDXL,
Expand Down Expand Up @@ -168,7 +169,8 @@
"CR Simple Banner": CR_SimpleBanner,
"CR Comic Panel Templates": CR_ComicPanelTemplates,
"CR Simple Image Compare": CR_SimpleImageCompare,
"CR Thumbnail Preview": CR_ThumbnailPreview,
"CR Thumbnail Preview": CR_ThumbnailPreview,
"CR Seamless Checker": CR_SeamlessChecker,
### Utils Logic
"CR Image Input Switch": CR_ImageInputSwitch,
"CR Image Input Switch (4 way)": CR_ImageInputSwitch4way,
Expand Down Expand Up @@ -227,6 +229,7 @@
"CR Math Operation": CR_MathOperation,
"CR Get Parameter From Prompt": CR_GetParameterFromPrompt,
"CR Select Resize Method": CR_SelectResizeMethod,
"CR Select ISO Size": CR_SelectISOSize,
### Animation Nodes
# Schedules
"CR Simple Schedule": CR_SimpleSchedule,
Expand Down Expand Up @@ -319,7 +322,8 @@
"CR SDXL Aspect Ratio": "🔳 CR SDXL Aspect Ratio",
"CR Aspect Ratio": "🔳 CR Aspect Ratio",
"CR Aspect Ratio Banners": "🔳 CR Aspect Ratio Banners",
"CR Aspect Ratio Social Media": "🔳 CR Aspect Ratio Social Media",
"CR Aspect Ratio Social Media": "🔳 CR Aspect Ratio Social Media",
"CR_Aspect Ratio For Print": "🔳 CR_Aspect Ratio For Print",
### Legacy Nodes
"CR Image Size": "CR Image Size (Legacy)",
"CR Aspect Ratio SDXL": "CR Aspect Ratio SDXL (Legacy)",
Expand Down Expand Up @@ -405,7 +409,8 @@
"CR Simple Banner": "📱 CR Simple Banner",
"CR Comic Panel Templates": "📱 CR Comic Panel Templates",
"CR Simple Image Compare": "📱 CR Simple Image Compare",
"CR Thumbnail Preview": "📱 CR Thumbnail Preview",
"CR Thumbnail Preview": "📱 CR Thumbnail Preview",
"CR Seamless Checker": "📱 CR Seamless Checker",
### Utils Logic
"CR Image Input Switch": "🔀 CR Image Input Switch",
"CR Image Input Switch (4 way)": "🔀 CR Image Input Switch (4 way)",
Expand Down Expand Up @@ -463,7 +468,8 @@
"CR Clamp Value": "⚙️ CR Clamp Value",
"CR Math Operation": "⚙️ CR Math Operation",
"CR Get Parameter From Prompt": "⚙️ CR Get Parameter From Prompt",
"CR Select Resize Method": "⚙️ CR Select Resize Method",
"CR Select Resize Method": "⚙️ CR Select Resize Method",
"CR Select ISO Size": "⚙️ CR Select ISO Size",
### Animation Nodes
# Schedules
"CR Simple Schedule": "📋 CR Simple Schedule",
Expand Down
82 changes: 77 additions & 5 deletions nodes/nodes_aspect_ratio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@
import torch
from ..categories import icons

PRINT_SIZES = {
"A4 - 2480x3508": (2480, 3508),
"A5 - 1748x2480": (1748, 2480),
"A6 - 1240x1748": (1240, 1748),
"A7 - 874x1240": (874, 1240),
"A8 - 614x874": (614, 874),
"A9 - 437x614": (437, 614),
"A10 - 307x437": (307, 437),
"B4 - 2953x4169": (2953, 4169),
"B5 - 2079x2953": (2079, 2953),
"B6 - 1476x2079": (1476, 2079),
"B7 - 1039x1476": (1039, 1476),
"B8 - 732x1039": (732, 1039),
"B9 - 520x732": (520, 732),
"B10 - 366x520": (366, 520),
"C4 - 2705x3827": (2705, 3827),
"C5 - 1913x2705": (1913, 2705),
"C6 - 1346x1913": (1346, 1913),
"C7 - 957x1346": (957, 1346),
"C8 - 673x957": (673, 957),
"C9 - 472x673": (472, 673),
"C10 - 331x472": (331, 472),
"Letter (8.5 x 11 inches) - 2550x3300": (2550, 3300),
"Legal (8.5 x 14 inches) - 2550x4200": (2550, 4200)
}

#---------------------------------------------------------------------------------------------------------------------#
# Aspect Ratio Nodes
#---------------------------------------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -319,8 +345,6 @@ def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_fac

#---------------------------------------------------------------------------------------------------------------------#
class CR_AspectRatioSocialMedia:
def __init__(self):
pass

@classmethod
def INPUT_TYPES(s):
Expand All @@ -339,6 +363,7 @@ def INPUT_TYPES(s):
"LinkedIn Page Cover - 1128x191",
"LinkedIn Post - 1200x627",
"Pinterest Pin Image - 1000x1500",
"CivitAI Cover - 1600x400",
"OpenArt App - 1500x1000"
]

Expand All @@ -360,7 +385,7 @@ def INPUT_TYPES(s):

def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_factor, prescale_factor, batch_size):

# Banner sizes
# Social media sizes
if aspect_ratio == "Instagram Portrait - 1080x1350":
width, height = 1080, 1350
elif aspect_ratio == "Instagram Square - 1080x1080":
Expand Down Expand Up @@ -388,7 +413,9 @@ def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_fac
elif aspect_ratio == "Pinterest Pin Image - 1000x1500":
width, height = 1000, 1500
elif aspect_ratio == "Pinterest Cover Image - 1920x1080":
width, height = 1920, 1080
width, height = 1920, 1080
elif aspect_ratio == "CivitAI Cover - 1600x400":
width, height = 1600, 400
elif aspect_ratio == "OpenArt App - 1500x1000":
width, height = 1500, 1000

Expand All @@ -403,6 +430,50 @@ def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_fac
show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Aspect-Ratio-Nodes#cr-aspect-ratio-scial-media"

return(width, height, upscale_factor, prescale_factor, batch_size, {"samples":latent}, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
class CR_AspectRatioForPrint:

@classmethod
def INPUT_TYPES(cls):

aspect_ratios = list(PRINT_SIZES.keys())

return {
"required": {
"width": ("INT", {"default": 1024, "min": 64, "max": 8192}),
"height": ("INT", {"default": 1024, "min": 64, "max": 8192}),
"aspect_ratio": (aspect_ratios,),
"swap_dimensions": (["Off", "On"],),
"upscale_factor": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 100.0, "step":0.1}),
"prescale_factor": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 100.0, "step":0.1}),
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64})
}
}
RETURN_TYPES = ("INT", "INT", "FLOAT", "FLOAT", "INT", "LATENT", "STRING", )
RETURN_NAMES = ("width", "height", "upscale_factor", "prescale_factor", "batch_size", "empty_latent", "show_help", )
FUNCTION = "Aspect_Ratio"
CATEGORY = icons.get("Comfyroll/Aspect Ratio")

def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_factor, prescale_factor, batch_size):

# Iso sizes
if aspect_ratio in PRINT_SIZES:
width, height = PRINT_SIZES[aspect_ratio]

if swap_dimensions == "On":
width, height = height, width

width = int(width*prescale_factor)
height = int(height*prescale_factor)

print(f"Width: {width}, Height: {height}")

latent = torch.zeros([batch_size, 4, height // 8, width // 8])

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Aspect-Ratio-Nodes#cr-aspect-ratio-scial-media"

return(width, height, upscale_factor, prescale_factor, batch_size, {"samples":latent}, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
# MAPPINGS
Expand All @@ -415,7 +486,8 @@ def Aspect_Ratio(self, width, height, aspect_ratio, swap_dimensions, upscale_fac
"CR SDXL Aspect Ratio": CR_SDXLAspectRatio,
"CR Aspect Ratio": CR_AspectRatio,
"CR Aspect Ratio Banners": CR_AspectRatioBanners,
"CR Aspect Ratio Social Media": CR_AspectRatioSocialMedia,
"CR Aspect Ratio Social Media": CR_AspectRatioSocialMedia,
"CR_Aspect Ratio For Print": CR_AspectRatioForPrint,
}
'''

34 changes: 33 additions & 1 deletion nodes/nodes_graphics_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from PIL import Image, ImageDraw, ImageOps, ImageFont, ImageFilter
from ..categories import icons
from ..config import color_mapping, COLORS
from ..config import iso_sizes
from .functions_graphics import *

#---------------------------------------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -607,6 +608,36 @@ def make_border(self, image,

return (images, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
class CR_SelectISOSize:

@classmethod
def INPUT_TYPES(cls):

sizes = list(iso_sizes.keys())

return {
"required": {
"iso_size": (sizes, ),
}
}

RETURN_TYPES =("INT", "INT","STRING", )
RETURN_NAMES =("width", "height","show_help", )
FUNCTION = "get_size"
CATEGORY = icons.get("Comfyroll/Utils/Other")

def get_size(self, iso_size):

if iso_size in iso_sizes:
width, height = iso_sizes[iso_size]
else:
print("Size not found.")

show_help = "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki/Other-Nodes#cr-select-iso-size"

return (width, height, show_help, )

#---------------------------------------------------------------------------------------------------------------------#
# MAPPINGS
#---------------------------------------------------------------------------------------------------------------------#
Expand All @@ -621,7 +652,8 @@ def make_border(self, image,
"CR Color Panel": CR_ColorPanel,
"CR Simple Text Panel": CR_SimpleTextPanel,
"CR Overlay Transparent Image": CR_OverlayTransparentImage,
"CR Simple Titles": CR_SimpleTitles,
#"CR Simple Titles": CR_SimpleTitles,
"CR Select ISO Size": CR_SelectISOSize,
}
'''

Loading

0 comments on commit d6ff722

Please sign in to comment.