MCPcopy Create free account
hub / github.com/Nynxz/ComfyUI-IdeogramHelper / execute

Method execute

backend/nodes/ref_sync.py:31–54  ·  view source on GitHub ↗
(cls, image, enable=True)

Source from the content-addressed store, hash-verified

29
30 @classmethod
31 def execute(cls, image, enable=True) -> io.NodeOutput:
32 ui_images = []
33 if enable and image is not None and getattr(image, "ndim", 0) == 4 and image.shape[0] > 0:
34 try:
35 import os
36 import time
37 import random
38 import numpy as np
39 import folder_paths
40 from PIL import Image as PILImage
41 from server import PromptServer
42
43 out_dir = folder_paths.get_temp_directory()
44 os.makedirs(out_dir, exist_ok=True)
45 arr = (image[0].cpu().numpy() * 255.0).clip(0, 255).astype(np.uint8)
46 fn = f"ideogram_ref_{int(time.time() * 1000)}_{random.randint(0, 9999)}.png"
47 PILImage.fromarray(arr).save(os.path.join(out_dir, fn))
48 payload = {"filename": fn, "subfolder": "", "type": "temp"}
49 PromptServer.instance.send_sync("ideogram-studio.ref-sync", payload)
50 ui_images = [payload]
51 except Exception as e:
52 print(f"[IdeogramRefSync] sync failed: {e}")
53
54 return io.NodeOutput(image, ui={"images": ui_images})

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected