Prevent potential int overflow in SaveImage

main
comfyanonymous 2 years ago
parent 44294a446e
commit 1f717903bc

@ -790,7 +790,7 @@ class SaveImage:
paths = list() paths = list()
for image in images: for image in images:
i = 255. * image.cpu().numpy() 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() metadata = PngInfo()
if prompt is not None: if prompt is not None:
metadata.add_text("prompt", json.dumps(prompt)) metadata.add_text("prompt", json.dumps(prompt))

Loading…
Cancel
Save