Preview only the first image in batch

This commit is contained in:
2026-04-22 15:57:33 -07:00
parent 16e05da2b4
commit a6b1d1027c

View File

@@ -167,13 +167,11 @@ class CompassImageLoader:
temp_dir = folder_paths.get_temp_directory()
prefix = "_compass_" + "".join(random.choice("abcdefghijklmnopqrstupvxyz") for _ in range(5))
results = []
for batch_number, img_tensor in enumerate(image_batch):
i = 255.0 * img_tensor.cpu().numpy()
pil_img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
file = f"{prefix}_{batch_number:05}_.png"
pil_img.save(os.path.join(temp_dir, file), compress_level=1)
results.append({"filename": file, "subfolder": "", "type": "temp"})
i = 255.0 * image_batch[0].cpu().numpy()
pil_img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
file = f"{prefix}_00000_.png"
pil_img.save(os.path.join(temp_dir, file), compress_level=1)
results = [{"filename": file, "subfolder": "", "type": "temp"}]
return {
"ui": {"images": results},