From 2d72cd8175c63e90c443594b5d636615e289c5a9 Mon Sep 17 00:00:00 2001 From: bennykok Date: Sat, 14 Sep 2024 21:49:17 -0700 Subject: [PATCH] fix: batch zip image input --- comfy-nodes/external_image_batch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/comfy-nodes/external_image_batch.py b/comfy-nodes/external_image_batch.py index 4004882..03c8474 100644 --- a/comfy-nodes/external_image_batch.py +++ b/comfy-nodes/external_image_batch.py @@ -56,12 +56,7 @@ class ComfyUIDeployExternalImageBatch: images_list = json.loads(images) # Assuming images is a JSON array string print(images_list) for img_input in images_list: - if img_input.startswith('http'): - from io import BytesIO - print("Fetching image from url: ", img_input) - response = requests.get(img_input) - image = Image.open(BytesIO(response.content)) - elif img_input.startswith('http') and img_input.endswith('.zip'): + if img_input.startswith('http') and img_input.endswith('.zip'): print("Fetching zip file from url: ", img_input) response = requests.get(img_input) zip_file = zipfile.ZipFile(io.BytesIO(response.content)) @@ -71,6 +66,11 @@ class ComfyUIDeployExternalImageBatch: image = Image.open(file) image = self.process_image(image) processed_images.append(image) + elif img_input.startswith('http'): + from io import BytesIO + print("Fetching image from url: ", img_input) + response = requests.get(img_input) + image = Image.open(BytesIO(response.content)) elif img_input.startswith('data:image/png;base64,') or img_input.startswith('data:image/jpeg;base64,') or img_input.startswith('data:image/jpg;base64,'): import base64 from io import BytesIO