Skip to content

Commit 24f8ade

Browse files
committed
batch
1 parent 815b2f9 commit 24f8ade

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

nodes/image_utility.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from calendar import c
12
from email.mime import image
23
import os
34
import io
@@ -89,6 +90,10 @@ def list_to_batch(tensor_list):
8990
return torch.cat(tensor_list)
9091

9192

93+
def tensorlist_to_batch(tensors):
94+
return torch.stack(tensors, dim=0)
95+
96+
9297
def rgba2rgb(pil):
9398
bg = Image.new("RGB", pil.size, (255, 255, 255))
9499
bg.paste(pil, pil)
@@ -864,21 +869,16 @@ def modulation(self, image):
864869
image[y, x + 1] += error * 1 # right
865870
return image
866871

867-
def ErrorDiffusionDithering(self, pil):
868-
# 转换为黑白255
869-
paletted = pil.convert("1", matrix=Image.FLOYDSTEINBERG)
870-
paletted = paletted.convert("RGB")
871-
return paletted
872-
873872
def node_function(self, images, dither):
874873
out_images = []
875874

876875
for image in images:
877876
pil = tensor_to_pil(image).convert("L")
878877
img_np = pil_to_np(pil)
879878
img_np = self.modulation(img_np)
880-
image = torch.from_numpy(img_np)
879+
pil = np_to_pil(img_np).convert("RGB")
880+
image = pil_to_tensor(pil)
881881
out_images.append(image)
882882

883-
out_images = torch.stack(out_images)
883+
out_images = torch.stack(out_images, dim=0)
884884
return (out_images,)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Python Script
6363
6464
Load LoRA Dual
6565
"""
66-
version = "1.0.70"
66+
version = "1.0.71"
6767
license = { file = "LICENSE" }
6868
dependencies = [
6969
"googletrans",

0 commit comments

Comments
 (0)