Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Prevent potential int overflow in SaveImage

comfyanonymous1f717903bc12
diff --git a/nodes.py b/nodes.py
index 7c88402f6..814f76a7f 100644
--- a/nodes.py
+++ b/nodes.py
@@ -790,7 +790,7 @@ class SaveImage:
paths = list()
for image in images:
i = 255. * image.cpu().numpy()
- img = Image.fromarray(i.astype(np.uint8))
+ img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
metadata = PngInfo()
if prompt is not None:
metadata.add_text("prompt", json.dumps(prompt))