Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3380d54d8 | ||
|
|
3ae13f538c | ||
|
|
59cf8ffb63 | ||
|
|
f601665a14 | ||
|
|
b3f5bd1136 | ||
|
|
3dd50ec293 | ||
|
|
45d044d4d0 | ||
|
|
98d3da8b3a | ||
|
|
1bc3f221b7 | ||
|
|
621e988764 | ||
|
|
1a05160eb2 | ||
|
|
9aff748a12 | ||
|
|
c627bb4e39 | ||
|
|
764c5e54f9 | ||
|
|
9963935c26 | ||
|
|
2059c14cff |
@@ -1,23 +1,27 @@
|
|||||||
# XYPlot: Comfy plugin
|
# ImagesGrid: Comfy plugin
|
||||||
|
|
||||||
|
|
||||||

|
## Preview
|
||||||
[Workflows](./workflows/xy_plot_mini.json)
|
|
||||||

|
### Simple grid of images
|
||||||
[Workflows](./workflows/xy_plot_base.json)
|
|
||||||
|

|
||||||
|
|
||||||
|
### XYZPlot, like in auto1111, but with more settings
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Workflows: https://github.com/LEv145/images-grid-comfy-plugin/tree/main/workflows
|
||||||
|
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
### Install
|
1. Download the latest stable release:
|
||||||
|
https://github.com/LEv145/images-grid-comfy-plugin/archive/refs/heads/main.zip
|
||||||
|
|
||||||
```
|
2. Unpack the node to `custom_nodes`, for example in a folder `custom_nodes/ImagesGrid/`
|
||||||
cd custom_nodes # From comfy path
|
|
||||||
git clone https://github.com/LEv145/XY-plot-comfy-plugin XYPlot
|
|
||||||
```
|
|
||||||
### Update
|
|
||||||
|
|
||||||
```
|
|
||||||
cd custom_nodes/XYPlot
|
## Source
|
||||||
git pull
|
|
||||||
```
|
https://github.com/LEv145/images-grid-comfy-plugin
|
||||||
|
|||||||
+11
-2
@@ -1,7 +1,16 @@
|
|||||||
from .src import LatentCombineNode, XYPlotNode
|
from .src import (
|
||||||
|
LatentCombineNode,
|
||||||
|
ImagesGridByColumnsNode,
|
||||||
|
ImagesGridByRowsNode,
|
||||||
|
ImageCombineNode,
|
||||||
|
GridAnnotationNode,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
"XYPlot": XYPlotNode,
|
|
||||||
"LatentCombine": LatentCombineNode,
|
"LatentCombine": LatentCombineNode,
|
||||||
|
"ImagesGridByColumns": ImagesGridByColumnsNode,
|
||||||
|
"ImagesGridByRows": ImagesGridByRowsNode,
|
||||||
|
"ImageCombine": ImageCombineNode,
|
||||||
|
"GridAnnotation": GridAnnotationNode,
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,2 +1,4 @@
|
|||||||
from .nodes.xy_plot import XYPlotNode
|
from .nodes.images_grid import ImagesGridByColumnsNode, ImagesGridByRowsNode
|
||||||
from .nodes.latent_combine import LatentCombineNode
|
from .nodes.latent_combine import LatentCombineNode
|
||||||
|
from .nodes.image_combine import ImageCombineNode
|
||||||
|
from .nodes.grid_annotation import GridAnnotationNode
|
||||||
|
|||||||
+6
-12
@@ -1,16 +1,10 @@
|
|||||||
import typing as t
|
import typing as t
|
||||||
from dataclasses import dataclass
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class BasePlotNode():
|
STATIC_PATH = Path(__file__).parent.parent / "static"
|
||||||
CATEGORY: str = "XYPlot"
|
|
||||||
|
|
||||||
|
class BaseNode():
|
||||||
|
CATEGORY: str = "ImagesGrid"
|
||||||
FUNCTION: str = "execute"
|
FUNCTION: str = "execute"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class KSamplerXYPlotInput():
|
|
||||||
setting: str
|
|
||||||
value: int
|
|
||||||
|
|
||||||
|
|
||||||
Image = t.Any
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import typing as t
|
|
||||||
|
|
||||||
from ..base import BasePlotNode, Image
|
|
||||||
|
|
||||||
|
|
||||||
class FloatImageCombineNode(BasePlotNode):
|
|
||||||
RETURN_TYPES: t.Tuple[str] = ("IMAGES",)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def INPUT_TYPES(cls) -> t.Dict[str, t.Any]:
|
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"float_image_1": ("IMAGES",),
|
|
||||||
"float_image_2": ("IMAGES",),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def execute(
|
|
||||||
self,
|
|
||||||
float_image_1: t.List[Image],
|
|
||||||
float_image_2: t.List[Image],
|
|
||||||
) -> t.Tuple[t.List[Image]]:
|
|
||||||
return (float_image_1 + float_image_2,)
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import typing as t
|
||||||
|
|
||||||
|
from PIL import ImageFont
|
||||||
|
|
||||||
|
from ..base import BaseNode, STATIC_PATH
|
||||||
|
from ..utils import Annotation
|
||||||
|
|
||||||
|
|
||||||
|
class GridAnnotationNode(BaseNode):
|
||||||
|
RETURN_TYPES: tuple[str] = ("GRID_ANNOTATION",)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> dict[str, t.Any]:
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"column_texts": ("STRING", {"multiline": False}),
|
||||||
|
"row_texts": ("STRING", {"multiline": False}),
|
||||||
|
"font_size": ("INT", {"default": 50, "min": 1}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def execute(
|
||||||
|
self,
|
||||||
|
column_texts: str,
|
||||||
|
row_texts: str,
|
||||||
|
font_size: int,
|
||||||
|
) -> tuple[Annotation]:
|
||||||
|
font = ImageFont.truetype(str(STATIC_PATH / "Roboto-Regular.ttf"), size=font_size)
|
||||||
|
column_texts_list = self._set_value_to_texts_list(
|
||||||
|
self._get_texts_from_string(column_texts),
|
||||||
|
)
|
||||||
|
row_texts_list = self._set_value_to_texts_list(
|
||||||
|
self._get_texts_from_string(row_texts),
|
||||||
|
)
|
||||||
|
|
||||||
|
result = Annotation(column_texts=column_texts_list, row_texts=row_texts_list, font=font)
|
||||||
|
return (result,)
|
||||||
|
|
||||||
|
def _get_texts_from_string(self, string: str) -> list[str]:
|
||||||
|
return [
|
||||||
|
result
|
||||||
|
for i in string.split(";")
|
||||||
|
if (result := i.strip()) != ""
|
||||||
|
]
|
||||||
|
|
||||||
|
def _set_value_to_texts_list(self, texts_list: list[str]) -> list[str]:
|
||||||
|
if not texts_list:
|
||||||
|
return ["None"]
|
||||||
|
return texts_list
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import typing as t
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
|
from ..base import BaseNode
|
||||||
|
|
||||||
|
|
||||||
|
class ImageCombineNode(BaseNode):
|
||||||
|
RETURN_TYPES: tuple[str] = ("IMAGE",)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> dict[str, t.Any]:
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"image_1": ("IMAGE",),
|
||||||
|
"image_2": ("IMAGE",),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def execute(
|
||||||
|
self,
|
||||||
|
image_1: torch.Tensor,
|
||||||
|
image_2: torch.Tensor,
|
||||||
|
) -> tuple[torch.Tensor]:
|
||||||
|
result = torch.cat((image_1, image_2), 0)
|
||||||
|
|
||||||
|
return (result,)
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import typing as t
|
|
||||||
|
|
||||||
from ..base import BasePlotNode, Image
|
|
||||||
|
|
||||||
|
|
||||||
class ImageSetAreaNode(BasePlotNode):
|
|
||||||
RETURN_TYPES: t.Tuple[str] = ("IMAGES",)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def INPUT_TYPES(cls) -> t.Dict[str, t.Any]:
|
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"image": ("IMAGE",),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def execute(self, image: Image) -> t.Tuple[t.List[Image]]:
|
|
||||||
return ([image],)
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import typing as t
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
|
from ..base import BaseNode
|
||||||
|
from ..utils import (
|
||||||
|
tensor_to_pillow,
|
||||||
|
pillow_to_tensor,
|
||||||
|
create_images_grid_by_columns,
|
||||||
|
create_images_grid_by_rows,
|
||||||
|
Annotation,
|
||||||
|
)
|
||||||
|
|
||||||
|
class BaseImagesGridNode(BaseNode):
|
||||||
|
RETURN_TYPES: tuple[str] = ("IMAGE",)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _create_input_types(cls, coordinate_name: str) -> dict[str, t.Any]:
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"images": ("IMAGE",),
|
||||||
|
"gap": ("INT", {"default": 0, "min": 0}),
|
||||||
|
coordinate_name: ("INT", {"default": 1, "min": 1}),
|
||||||
|
},
|
||||||
|
"optional": {
|
||||||
|
"annotation": ("GRID_ANNOTATION",),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _create_execute(
|
||||||
|
self,
|
||||||
|
function: t.Callable,
|
||||||
|
\
|
||||||
|
images: torch.Tensor,
|
||||||
|
gap: int,
|
||||||
|
annotation: Annotation | None = None,
|
||||||
|
**kw,
|
||||||
|
) -> tuple[torch.Tensor]:
|
||||||
|
pillow_images = [tensor_to_pillow(i) for i in images]
|
||||||
|
pillow_grid = function(
|
||||||
|
images=pillow_images,
|
||||||
|
gap=gap,
|
||||||
|
annotation=annotation,
|
||||||
|
**kw,
|
||||||
|
)
|
||||||
|
tensor_grid = pillow_to_tensor(pillow_grid)
|
||||||
|
|
||||||
|
return (tensor_grid,)
|
||||||
|
|
||||||
|
|
||||||
|
class ImagesGridByColumnsNode(BaseImagesGridNode):
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> dict[str, t.Any]:
|
||||||
|
return cls._create_input_types("max_columns")
|
||||||
|
|
||||||
|
def execute(self, **kw) -> tuple[torch.Tensor]:
|
||||||
|
return self._create_execute(create_images_grid_by_columns, **kw)
|
||||||
|
|
||||||
|
|
||||||
|
class ImagesGridByRowsNode(BaseImagesGridNode):
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls) -> dict[str, t.Any]:
|
||||||
|
return cls._create_input_types("max_rows")
|
||||||
|
|
||||||
|
def execute(self, **kw) -> tuple[torch.Tensor]:
|
||||||
|
return self._create_execute(create_images_grid_by_rows, **kw)
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
import typing as t
|
|
||||||
|
|
||||||
from nodes import KSamplerAdvanced # type: ignore
|
|
||||||
|
|
||||||
from ..base import BasePlotNode, Image, KSamplerXYPlotInput
|
|
||||||
|
|
||||||
|
|
||||||
class KSamplerXYPlotNode(BasePlotNode):
|
|
||||||
RETURN_TYPES: t.Tuple[str] = ("IMAGES",)
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
|
||||||
self._sampler = KSamplerAdvanced()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def INPUT_TYPES(cls):
|
|
||||||
result = KSamplerAdvanced.INPUT_TYPES()
|
|
||||||
result["required"]["vae"] = ("VAE", )
|
|
||||||
#result["required"]["x_items"] = ("XYPlotItem",)
|
|
||||||
#result["required"]["y_items"] = ("XYPlotItem",)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def execute(
|
|
||||||
self,
|
|
||||||
vae,
|
|
||||||
#x_items,
|
|
||||||
#y_items,
|
|
||||||
**sampler_kw,
|
|
||||||
) -> tuple[t.List[Image]]:
|
|
||||||
x_items = [
|
|
||||||
KSamplerXYPlotInput(value=1, setting="cfg"),
|
|
||||||
KSamplerXYPlotInput(value=2, setting="cfg"),
|
|
||||||
]
|
|
||||||
y_items = [
|
|
||||||
KSamplerXYPlotInput(value=1, setting="noise_seed"),
|
|
||||||
KSamplerXYPlotInput(value=2, setting="noise_seed"),
|
|
||||||
]
|
|
||||||
|
|
||||||
latents = self._sample_latents(
|
|
||||||
x_items=x_items,
|
|
||||||
y_items=y_items,
|
|
||||||
sampler_kw=sampler_kw,
|
|
||||||
)
|
|
||||||
result = list(self._decode_latents(latents=latents, vae=vae))
|
|
||||||
print(result)
|
|
||||||
print(type(result[0]))
|
|
||||||
|
|
||||||
return (result,)
|
|
||||||
|
|
||||||
def _sample_latents(self, x_items, y_items, sampler_kw):
|
|
||||||
for x in x_items:
|
|
||||||
for y in y_items:
|
|
||||||
sampler_settings = sampler_kw.copy()
|
|
||||||
sampler_settings[x.setting] = x.value
|
|
||||||
sampler_settings[y.setting] = y.value
|
|
||||||
|
|
||||||
yield self._sampler.sample(**sampler_settings)[0]
|
|
||||||
|
|
||||||
def _decode_latents(self, latents, vae) -> t.Iterable[Image]:
|
|
||||||
return (
|
|
||||||
vae.decode(i["samples"])
|
|
||||||
for i in latents
|
|
||||||
)
|
|
||||||
@@ -2,14 +2,14 @@ import typing as t
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from ..base import BasePlotNode, Image
|
from ..base import BaseNode
|
||||||
|
|
||||||
|
|
||||||
class LatentCombineNode(BasePlotNode):
|
class LatentCombineNode(BaseNode):
|
||||||
RETURN_TYPES: t.Tuple[str] = ("LATENT",)
|
RETURN_TYPES: tuple[str] = ("LATENT",)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> t.Dict[str, t.Any]:
|
def INPUT_TYPES(cls) -> dict[str, t.Any]:
|
||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"latent_1": ("LATENT",),
|
"latent_1": ("LATENT",),
|
||||||
@@ -19,11 +19,9 @@ class LatentCombineNode(BasePlotNode):
|
|||||||
|
|
||||||
def execute(
|
def execute(
|
||||||
self,
|
self,
|
||||||
latent_1: t.Dict[str, t.Any],
|
latent_1: dict[str, torch.Tensor],
|
||||||
latent_2: t.Dict[str, t.Any],
|
latent_2: dict[str, torch.Tensor],
|
||||||
) -> t.Tuple[t.Dict[str, t.Any]]:
|
) -> tuple[dict[str, torch.Tensor]]:
|
||||||
latent_1_samples = latent_1["samples"]
|
samples = torch.cat((latent_1["samples"], latent_2["samples"]), 0)
|
||||||
latent_2_samples = latent_2["samples"]
|
|
||||||
samples = torch.cat((latent_1_samples, latent_2_samples), 0)
|
|
||||||
|
|
||||||
return ({"samples": samples},)
|
return ({"samples": samples},)
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
import typing as t
|
|
||||||
|
|
||||||
from ..base import BasePlotNode, Image
|
|
||||||
from ..utils import tensor_to_pillow, pillow_to_tensor, create_image_grid
|
|
||||||
|
|
||||||
|
|
||||||
class XYPlotNode(BasePlotNode):
|
|
||||||
RETURN_TYPES: t.Tuple[str] = ("IMAGE",)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def INPUT_TYPES(cls) -> t.Dict[str, t.Any]:
|
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"images": ("IMAGE",),
|
|
||||||
"gap": ("INT", {"default": 0, "min": 0}),
|
|
||||||
"nrow": ("INT", {"default": 1, "min": 1}),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def execute(
|
|
||||||
self,
|
|
||||||
images: Image,
|
|
||||||
nrow: int,
|
|
||||||
gap: int
|
|
||||||
) -> tuple[Image]:
|
|
||||||
pillow_images = [tensor_to_pillow(i) for i in images]
|
|
||||||
pillow_grid = create_image_grid(pillow_images, nrow=nrow, gap=gap)
|
|
||||||
tensor_grid = pillow_to_tensor(pillow_grid)
|
|
||||||
|
|
||||||
return (tensor_grid,)
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import typing as t
|
|
||||||
|
|
||||||
import torch
|
|
||||||
import numpy as np
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
|
|
||||||
def tensor_to_pillow(image):
|
|
||||||
return Image.fromarray(np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8))
|
|
||||||
|
|
||||||
|
|
||||||
def pillow_to_tensor(image):
|
|
||||||
return torch.from_numpy(np.array(image).astype(np.float32) / 255.0).unsqueeze(0)
|
|
||||||
|
|
||||||
|
|
||||||
def create_image_grid(images: t.List[Image.Image], gap: int, ncol: int):
|
|
||||||
# Calculate the number of rows needed based on the number of images and columns
|
|
||||||
nrow = (len(images) + ncol - 1) // ncol
|
|
||||||
|
|
||||||
# Get the size of the first image to use as a template for the grid
|
|
||||||
size = images[0].size
|
|
||||||
|
|
||||||
# Calculate the total size of the grid with gaps
|
|
||||||
width = size[0] * ncol + gap * (ncol - 1)
|
|
||||||
height = size[1] * nrow + gap * (nrow - 1)
|
|
||||||
|
|
||||||
# Create a new image for the grid
|
|
||||||
grid_image = Image.new("RGB", (width, height), color="white")
|
|
||||||
|
|
||||||
# Iterate over each image and paste it into the grid
|
|
||||||
for i, image in enumerate(images):
|
|
||||||
# Calculate the position of the image in the grid
|
|
||||||
x = (i % ncol) * (size[0] + gap)
|
|
||||||
y = (i // ncol) * (size[1] + gap)
|
|
||||||
|
|
||||||
# Paste the image into the grid
|
|
||||||
grid_image.paste(image, (x, y))
|
|
||||||
|
|
||||||
return grid_image
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from .images_grid import (
|
||||||
|
create_images_grid_by_columns,
|
||||||
|
create_images_grid_by_rows,
|
||||||
|
Annotation,
|
||||||
|
)
|
||||||
|
from .tensor_convert import tensor_to_pillow, pillow_to_tensor
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
import typing as t
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Annotation():
|
||||||
|
column_texts: list[str]
|
||||||
|
row_texts: list[str]
|
||||||
|
font: ImageFont.FreeTypeFont
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class _GridInfo():
|
||||||
|
image: Image.Image
|
||||||
|
gap: int
|
||||||
|
one_image_size: tuple[int, int]
|
||||||
|
|
||||||
|
|
||||||
|
def create_images_grid_by_columns(
|
||||||
|
images: list[Image.Image],
|
||||||
|
gap: int,
|
||||||
|
max_columns: int,
|
||||||
|
annotation: Annotation | None = None,
|
||||||
|
) -> Image.Image:
|
||||||
|
max_rows = (len(images) + max_columns - 1) // max_columns
|
||||||
|
return _create_images_grid(images, gap, max_columns, max_rows, annotation)
|
||||||
|
|
||||||
|
|
||||||
|
def create_images_grid_by_rows(
|
||||||
|
images: list[Image.Image],
|
||||||
|
gap: int,
|
||||||
|
max_rows: int,
|
||||||
|
annotation: Annotation | None = None,
|
||||||
|
) -> Image.Image:
|
||||||
|
max_columns = (len(images) + max_rows - 1) // max_rows
|
||||||
|
return _create_images_grid(images, gap, max_columns, max_rows, annotation)
|
||||||
|
|
||||||
|
|
||||||
|
def _create_images_grid(
|
||||||
|
images: list[Image.Image],
|
||||||
|
gap: int,
|
||||||
|
max_columns: int,
|
||||||
|
max_rows: int,
|
||||||
|
annotation: Annotation | None,
|
||||||
|
) -> Image.Image:
|
||||||
|
size = images[0].size
|
||||||
|
grid_width = size[0] * max_columns + (max_columns - 1) * gap
|
||||||
|
grid_height = size[1] * max_rows + (max_rows - 1) * gap
|
||||||
|
|
||||||
|
grid_image = Image.new("RGB", (grid_width, grid_height), color="white")
|
||||||
|
|
||||||
|
_arrange_images_on_grid(grid_image, images=images, size=size, max_columns=max_columns, gap=gap)
|
||||||
|
|
||||||
|
if annotation is None:
|
||||||
|
return grid_image
|
||||||
|
return _create_grid_annotations(
|
||||||
|
grid_info=_GridInfo(
|
||||||
|
image=grid_image,
|
||||||
|
gap=gap,
|
||||||
|
one_image_size=size,
|
||||||
|
),
|
||||||
|
column_texts=annotation.column_texts,
|
||||||
|
row_texts=annotation.row_texts,
|
||||||
|
font=annotation.font,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _arrange_images_on_grid(
|
||||||
|
grid_image: Image.Image,
|
||||||
|
/,
|
||||||
|
images: list[Image.Image],
|
||||||
|
size: tuple[int, int],
|
||||||
|
max_columns: int,
|
||||||
|
gap: int,
|
||||||
|
):
|
||||||
|
for i, image in enumerate(images):
|
||||||
|
if image.size != size:
|
||||||
|
image = image.crop((0, 0, *size))
|
||||||
|
x = (i % max_columns) * (size[0] + gap)
|
||||||
|
y = (i // max_columns) * (size[1] + gap)
|
||||||
|
|
||||||
|
grid_image.paste(image, (x, y))
|
||||||
|
|
||||||
|
|
||||||
|
def _create_grid_annotations(
|
||||||
|
grid_info: _GridInfo,
|
||||||
|
column_texts,
|
||||||
|
row_texts,
|
||||||
|
font: ImageFont.FreeTypeFont,
|
||||||
|
) -> Image.Image:
|
||||||
|
if not column_texts or not row_texts:
|
||||||
|
raise ValueError("Column text or row text is empty")
|
||||||
|
|
||||||
|
grid = grid_info.image
|
||||||
|
margin = font.size // 2
|
||||||
|
left_padding = int(max(map(font.getlength, row_texts))) + 2*margin
|
||||||
|
top_padding = font.size + 2*margin
|
||||||
|
|
||||||
|
image = Image.new(
|
||||||
|
"RGB",
|
||||||
|
(grid.size[0] + left_padding, grid.size[1] + top_padding),
|
||||||
|
color="white",
|
||||||
|
)
|
||||||
|
draw = ImageDraw.Draw(image)
|
||||||
|
draw.font = font # type: ignore
|
||||||
|
|
||||||
|
_paste_image_to_lower_left_corner(image, grid)
|
||||||
|
_draw_column_text(
|
||||||
|
draw=draw,
|
||||||
|
texts=column_texts,
|
||||||
|
grid_info=grid_info,
|
||||||
|
left_padding=left_padding,
|
||||||
|
top_padding=top_padding,
|
||||||
|
)
|
||||||
|
_draw_row_text(
|
||||||
|
draw=draw,
|
||||||
|
texts=row_texts,
|
||||||
|
grid_info=grid_info,
|
||||||
|
left_padding=left_padding,
|
||||||
|
top_padding=top_padding,
|
||||||
|
)
|
||||||
|
|
||||||
|
return image
|
||||||
|
|
||||||
|
|
||||||
|
def _draw_column_text(
|
||||||
|
draw: ImageDraw.ImageDraw,
|
||||||
|
texts: list[str],
|
||||||
|
grid_info: _GridInfo,
|
||||||
|
left_padding: int,
|
||||||
|
top_padding: int,
|
||||||
|
) -> None:
|
||||||
|
i = 0
|
||||||
|
x0 = left_padding
|
||||||
|
y0 = 0
|
||||||
|
x1 = left_padding + grid_info.one_image_size[0]
|
||||||
|
y1 = top_padding
|
||||||
|
while x0 != grid_info.image.size[0] + left_padding + grid_info.gap:
|
||||||
|
i = _draw_text_by_xy((x0, y0, x1, y1), i, draw=draw, texts=texts)
|
||||||
|
x0 += grid_info.one_image_size[0] + grid_info.gap
|
||||||
|
x1 += grid_info.one_image_size[0] + grid_info.gap
|
||||||
|
|
||||||
|
|
||||||
|
def _draw_row_text(
|
||||||
|
draw: ImageDraw.ImageDraw,
|
||||||
|
texts: list[str],
|
||||||
|
grid_info: _GridInfo,
|
||||||
|
left_padding: int,
|
||||||
|
top_padding: int,
|
||||||
|
) -> None:
|
||||||
|
i = 0
|
||||||
|
x0 = 0
|
||||||
|
y0 = top_padding
|
||||||
|
x1 = left_padding
|
||||||
|
y1 = top_padding + grid_info.one_image_size[1]
|
||||||
|
while y0 != grid_info.image.size[1] + top_padding + grid_info.gap:
|
||||||
|
i = _draw_text_by_xy((x0, y0, x1, y1), i, draw=draw, texts=texts)
|
||||||
|
y0 += grid_info.one_image_size[1] + grid_info.gap
|
||||||
|
y1 += grid_info.one_image_size[1] + grid_info.gap
|
||||||
|
|
||||||
|
|
||||||
|
def _draw_text_by_xy(
|
||||||
|
xy: tuple[int, int, int, int],
|
||||||
|
index: int,
|
||||||
|
\
|
||||||
|
draw: ImageDraw.ImageDraw,
|
||||||
|
texts: list[str],
|
||||||
|
) -> int:
|
||||||
|
with suppress(IndexError):
|
||||||
|
_draw_center_text(draw, xy, texts[index])
|
||||||
|
return index + 1
|
||||||
|
|
||||||
|
|
||||||
|
def _draw_center_text(
|
||||||
|
draw: ImageDraw.ImageDraw,
|
||||||
|
xy: tuple[int, int, int, int],
|
||||||
|
text: str,
|
||||||
|
fill: t.Any = "black",
|
||||||
|
) -> None:
|
||||||
|
_, _, *text_size = draw.textbbox((0, 0), text)
|
||||||
|
draw.text(
|
||||||
|
(
|
||||||
|
(xy[2] - text_size[0] + xy[0]) / 2,
|
||||||
|
(xy[3] - text_size[1] + xy[1]) / 2,
|
||||||
|
),
|
||||||
|
text,
|
||||||
|
fill=fill,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _paste_image_to_lower_left_corner(base: Image.Image, image: Image.Image) -> None:
|
||||||
|
base.paste(image, (base.size[0] - image.size[0], base.size[1] - image.size[1]))
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import typing as t
|
||||||
|
|
||||||
|
import torch
|
||||||
|
import numpy as np
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
|
def tensor_to_pillow(image: t.Any) -> Image.Image:
|
||||||
|
return Image.fromarray(np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8))
|
||||||
|
|
||||||
|
|
||||||
|
def pillow_to_tensor(image: Image.Image) -> t.Any:
|
||||||
|
return torch.from_numpy(np.array(image).astype(np.float32) / 255.0).unsqueeze(0)
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 309 KiB |
@@ -0,0 +1,799 @@
|
|||||||
|
{
|
||||||
|
"last_node_id": 74,
|
||||||
|
"last_link_id": 126,
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": 68,
|
||||||
|
"type": "LoadImage",
|
||||||
|
"pos": [
|
||||||
|
-30,
|
||||||
|
70
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"order": 0,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
119
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MASK",
|
||||||
|
"type": "MASK",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "LoadImage"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"394102.png",
|
||||||
|
"image"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 41,
|
||||||
|
"type": "LoadImage",
|
||||||
|
"pos": [
|
||||||
|
-30,
|
||||||
|
210
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"order": 1,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
120
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MASK",
|
||||||
|
"type": "MASK",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "LoadImage"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"394102.png",
|
||||||
|
"image"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 42,
|
||||||
|
"type": "LoadImage",
|
||||||
|
"pos": [
|
||||||
|
-30,
|
||||||
|
350
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"order": 2,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
112
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MASK",
|
||||||
|
"type": "MASK",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "LoadImage"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"394102.png",
|
||||||
|
"image"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 43,
|
||||||
|
"type": "LoadImage",
|
||||||
|
"pos": [
|
||||||
|
-30,
|
||||||
|
490
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"order": 3,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
106
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MASK",
|
||||||
|
"type": "MASK",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "LoadImage"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"394102.png",
|
||||||
|
"image"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 62,
|
||||||
|
"type": "LoadImage",
|
||||||
|
"pos": [
|
||||||
|
-30,
|
||||||
|
630
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"order": 4,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
105
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MASK",
|
||||||
|
"type": "MASK",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "LoadImage"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"394102.png",
|
||||||
|
"image"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 63,
|
||||||
|
"type": "LoadImage",
|
||||||
|
"pos": [
|
||||||
|
-30,
|
||||||
|
770
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"collapsed": true
|
||||||
|
},
|
||||||
|
"order": 5,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
104
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "MASK",
|
||||||
|
"type": "MASK",
|
||||||
|
"links": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "LoadImage"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"394102.png",
|
||||||
|
"image"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 65,
|
||||||
|
"type": "ImageCombine",
|
||||||
|
"pos": [
|
||||||
|
460,
|
||||||
|
430
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 210,
|
||||||
|
"1": 46
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 9,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "image_1",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 113
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "image_2",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 106
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
114
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImageCombine"
|
||||||
|
},
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 67,
|
||||||
|
"type": "ImageCombine",
|
||||||
|
"pos": [
|
||||||
|
460,
|
||||||
|
350
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 210,
|
||||||
|
"1": 46
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 8,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "image_1",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 118
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "image_2",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 112
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
113
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImageCombine"
|
||||||
|
},
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 69,
|
||||||
|
"type": "ImageCombine",
|
||||||
|
"pos": [
|
||||||
|
460,
|
||||||
|
270
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 210,
|
||||||
|
"1": 46
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 7,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "image_1",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 119
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "image_2",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
118
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImageCombine"
|
||||||
|
},
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 55,
|
||||||
|
"type": "ImageCombine",
|
||||||
|
"pos": [
|
||||||
|
460,
|
||||||
|
510
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 210,
|
||||||
|
"1": 46
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 10,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "image_1",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 114
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "image_2",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 105
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
110
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImageCombine"
|
||||||
|
},
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 54,
|
||||||
|
"type": "ImageCombine",
|
||||||
|
"pos": [
|
||||||
|
460,
|
||||||
|
590
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 210,
|
||||||
|
"1": 46
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 11,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "image_1",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 110
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "image_2",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 104
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
115,
|
||||||
|
122
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImageCombine"
|
||||||
|
},
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 73,
|
||||||
|
"type": "Reroute",
|
||||||
|
"pos": [
|
||||||
|
1370,
|
||||||
|
240
|
||||||
|
],
|
||||||
|
"size": [
|
||||||
|
75,
|
||||||
|
26
|
||||||
|
],
|
||||||
|
"flags": {},
|
||||||
|
"order": 15,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"type": "*",
|
||||||
|
"link": 125,
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
124
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"showOutputText": false,
|
||||||
|
"horizontal": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 74,
|
||||||
|
"type": "PreviewImage",
|
||||||
|
"pos": [
|
||||||
|
1098,
|
||||||
|
383
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 332.1975402832031,
|
||||||
|
"1": 513.37060546875
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 14,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "images",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 126
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "PreviewImage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 72,
|
||||||
|
"type": "PreviewImage",
|
||||||
|
"pos": [
|
||||||
|
1460,
|
||||||
|
380
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 353,
|
||||||
|
"1": 510
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 16,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "images",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 124
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "PreviewImage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 61,
|
||||||
|
"type": "ImagesGridByRows",
|
||||||
|
"pos": [
|
||||||
|
740,
|
||||||
|
380
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 12,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "images",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 115
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "annotation",
|
||||||
|
"type": "GRID_ANNOTATION",
|
||||||
|
"link": 102
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
126
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImagesGridByRows"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
30,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 71,
|
||||||
|
"type": "ImagesGridByColumns",
|
||||||
|
"pos": [
|
||||||
|
740,
|
||||||
|
233
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 102
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 13,
|
||||||
|
"mode": 0,
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "images",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"link": 122
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "annotation",
|
||||||
|
"type": "GRID_ANNOTATION",
|
||||||
|
"link": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "IMAGE",
|
||||||
|
"type": "IMAGE",
|
||||||
|
"links": [
|
||||||
|
125
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "ImagesGridByColumns"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
30,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 60,
|
||||||
|
"type": "GridAnnotation",
|
||||||
|
"pos": [
|
||||||
|
350,
|
||||||
|
690
|
||||||
|
],
|
||||||
|
"size": {
|
||||||
|
"0": 315,
|
||||||
|
"1": 106
|
||||||
|
},
|
||||||
|
"flags": {},
|
||||||
|
"order": 6,
|
||||||
|
"mode": 0,
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "GRID_ANNOTATION",
|
||||||
|
"type": "GRID_ANNOTATION",
|
||||||
|
"links": [
|
||||||
|
102
|
||||||
|
],
|
||||||
|
"slot_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"Node name for S&R": "GridAnnotation"
|
||||||
|
},
|
||||||
|
"widgets_values": [
|
||||||
|
"Column 1; Column 2; Column 3",
|
||||||
|
"My favorite;Others",
|
||||||
|
400
|
||||||
|
],
|
||||||
|
"color": "#322",
|
||||||
|
"bgcolor": "#533"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": [
|
||||||
|
[
|
||||||
|
102,
|
||||||
|
60,
|
||||||
|
0,
|
||||||
|
61,
|
||||||
|
1,
|
||||||
|
"GRID_ANNOTATION"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
104,
|
||||||
|
63,
|
||||||
|
0,
|
||||||
|
54,
|
||||||
|
1,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
105,
|
||||||
|
62,
|
||||||
|
0,
|
||||||
|
55,
|
||||||
|
1,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
106,
|
||||||
|
43,
|
||||||
|
0,
|
||||||
|
65,
|
||||||
|
1,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
110,
|
||||||
|
55,
|
||||||
|
0,
|
||||||
|
54,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
112,
|
||||||
|
42,
|
||||||
|
0,
|
||||||
|
67,
|
||||||
|
1,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
113,
|
||||||
|
67,
|
||||||
|
0,
|
||||||
|
65,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
114,
|
||||||
|
65,
|
||||||
|
0,
|
||||||
|
55,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
115,
|
||||||
|
54,
|
||||||
|
0,
|
||||||
|
61,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
118,
|
||||||
|
69,
|
||||||
|
0,
|
||||||
|
67,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
119,
|
||||||
|
68,
|
||||||
|
0,
|
||||||
|
69,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
120,
|
||||||
|
41,
|
||||||
|
0,
|
||||||
|
69,
|
||||||
|
1,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
122,
|
||||||
|
54,
|
||||||
|
0,
|
||||||
|
71,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
124,
|
||||||
|
73,
|
||||||
|
0,
|
||||||
|
72,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
125,
|
||||||
|
71,
|
||||||
|
0,
|
||||||
|
73,
|
||||||
|
0,
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
126,
|
||||||
|
61,
|
||||||
|
0,
|
||||||
|
74,
|
||||||
|
0,
|
||||||
|
"IMAGE"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"groups": [],
|
||||||
|
"config": {},
|
||||||
|
"extra": {},
|
||||||
|
"version": 0.4
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 435 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB |
@@ -1,445 +0,0 @@
|
|||||||
{
|
|
||||||
"last_node_id": 44,
|
|
||||||
"last_link_id": 75,
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"id": 15,
|
|
||||||
"type": "PreviewImage",
|
|
||||||
"pos": [
|
|
||||||
1435,
|
|
||||||
325
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 363.55511474609375,
|
|
||||||
"1": 290.6986999511719
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 9,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "images",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"link": 20
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "PreviewImage"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 10,
|
|
||||||
"type": "ImageSetArea",
|
|
||||||
"pos": [
|
|
||||||
437,
|
|
||||||
307
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 216.59999084472656,
|
|
||||||
"1": 26
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 3,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "image",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"link": 73
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGES",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"links": [
|
|
||||||
12
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "ImageSetArea"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 12,
|
|
||||||
"type": "FloatImageCombine",
|
|
||||||
"pos": [
|
|
||||||
711,
|
|
||||||
301
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 317.4000244140625,
|
|
||||||
"1": 46
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 6,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "float_image_1",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"link": 12
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "float_image_2",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"link": 13
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGES",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"links": [
|
|
||||||
32
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "FloatImageCombine"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 19,
|
|
||||||
"type": "FloatImageCombine",
|
|
||||||
"pos": [
|
|
||||||
712,
|
|
||||||
387
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 317.4000244140625,
|
|
||||||
"1": 46
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 7,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "float_image_1",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"link": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "float_image_2",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"link": 22
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGES",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"links": [
|
|
||||||
24
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "FloatImageCombine"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 11,
|
|
||||||
"type": "ImageSetArea",
|
|
||||||
"pos": [
|
|
||||||
441,
|
|
||||||
372
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 216.59999084472656,
|
|
||||||
"1": 26
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 4,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "image",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"link": 74,
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGES",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"links": [
|
|
||||||
13
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "ImageSetArea"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 18,
|
|
||||||
"type": "ImageSetArea",
|
|
||||||
"pos": [
|
|
||||||
439,
|
|
||||||
439
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 216.59999084472656,
|
|
||||||
"1": 26
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 5,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "image",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"link": 75
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGES",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"links": [
|
|
||||||
22
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "ImageSetArea"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 41,
|
|
||||||
"type": "LoadImage",
|
|
||||||
"pos": [
|
|
||||||
69,
|
|
||||||
307
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 315,
|
|
||||||
"1": 102
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 0,
|
|
||||||
"mode": 0,
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGE",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"links": [
|
|
||||||
73
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "MASK",
|
|
||||||
"type": "MASK",
|
|
||||||
"links": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "LoadImage"
|
|
||||||
},
|
|
||||||
"widgets_values": [
|
|
||||||
"ComfyUI_00171_.png",
|
|
||||||
"image"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 43,
|
|
||||||
"type": "LoadImage",
|
|
||||||
"pos": [
|
|
||||||
68,
|
|
||||||
592
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 315,
|
|
||||||
"1": 102
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 2,
|
|
||||||
"mode": 0,
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGE",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"links": [
|
|
||||||
75
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "MASK",
|
|
||||||
"type": "MASK",
|
|
||||||
"links": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "LoadImage"
|
|
||||||
},
|
|
||||||
"widgets_values": [
|
|
||||||
"ComfyUI_00116_.png",
|
|
||||||
"image"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 17,
|
|
||||||
"type": "XYPlot",
|
|
||||||
"pos": [
|
|
||||||
1075,
|
|
||||||
326
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 315,
|
|
||||||
"1": 82
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 8,
|
|
||||||
"mode": 0,
|
|
||||||
"inputs": [
|
|
||||||
{
|
|
||||||
"name": "images",
|
|
||||||
"type": "IMAGES",
|
|
||||||
"link": 24
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGE",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"links": [
|
|
||||||
20
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "XYPlot"
|
|
||||||
},
|
|
||||||
"widgets_values": [
|
|
||||||
10,
|
|
||||||
2
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 42,
|
|
||||||
"type": "LoadImage",
|
|
||||||
"pos": [
|
|
||||||
69,
|
|
||||||
449
|
|
||||||
],
|
|
||||||
"size": {
|
|
||||||
"0": 315,
|
|
||||||
"1": 102
|
|
||||||
},
|
|
||||||
"flags": {},
|
|
||||||
"order": 1,
|
|
||||||
"mode": 0,
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "IMAGE",
|
|
||||||
"type": "IMAGE",
|
|
||||||
"links": [
|
|
||||||
74
|
|
||||||
],
|
|
||||||
"slot_index": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "MASK",
|
|
||||||
"type": "MASK",
|
|
||||||
"links": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"Node name for S&R": "LoadImage"
|
|
||||||
},
|
|
||||||
"widgets_values": [
|
|
||||||
"ComfyUI_00153_.png",
|
|
||||||
"image"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"links": [
|
|
||||||
[
|
|
||||||
12,
|
|
||||||
10,
|
|
||||||
0,
|
|
||||||
12,
|
|
||||||
0,
|
|
||||||
"IMAGES"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
13,
|
|
||||||
11,
|
|
||||||
0,
|
|
||||||
12,
|
|
||||||
1,
|
|
||||||
"IMAGES"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
20,
|
|
||||||
17,
|
|
||||||
0,
|
|
||||||
15,
|
|
||||||
0,
|
|
||||||
"IMAGE"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
22,
|
|
||||||
18,
|
|
||||||
0,
|
|
||||||
19,
|
|
||||||
1,
|
|
||||||
"IMAGES"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
24,
|
|
||||||
19,
|
|
||||||
0,
|
|
||||||
17,
|
|
||||||
0,
|
|
||||||
"IMAGES"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
32,
|
|
||||||
12,
|
|
||||||
0,
|
|
||||||
19,
|
|
||||||
0,
|
|
||||||
"IMAGES"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
73,
|
|
||||||
41,
|
|
||||||
0,
|
|
||||||
10,
|
|
||||||
0,
|
|
||||||
"IMAGE"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
74,
|
|
||||||
42,
|
|
||||||
0,
|
|
||||||
11,
|
|
||||||
0,
|
|
||||||
"IMAGE"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
75,
|
|
||||||
43,
|
|
||||||
0,
|
|
||||||
18,
|
|
||||||
0,
|
|
||||||
"IMAGE"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"groups": [],
|
|
||||||
"config": {},
|
|
||||||
"extra": {},
|
|
||||||
"version": 0.4
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 178 KiB |
Reference in New Issue
Block a user