Does anyone know how does Comfy store metadata in images? I'm trying to print it for the grid comparisons but it doesn't seem to be working.
# Use regular expressions to find the specific parameters
sampler_match = re.search(r"Sampler: ([\w\s\+]+(?: ancestral)?)", metadata_text, re.IGNORECASE)
scheduler_match = re.search(r"Scheduler: (\w+)", metadata_text, re.IGNORECASE)
steps_match = re.search(r"Steps: (\d+)", metadata_text, re.IGNORECASE)
cfg_match = re.search(r"CFG scale: ([\d\.]+)", metadata_text, re.IGNORECASE)
# Build the label string from found parameters
labels = []
if sampler_match:
labels.append(f"Sampler: {sampler_match.group(1).strip()}")
if scheduler_match:
labels.append(f"Scheduler: {scheduler_match.group(1).strip()}")
if steps_match:
labels.append(f"Steps: {steps_match.group(1).strip()}")
if cfg_match:
labels.append(f"CFG: {cfg_match.group(1).strip()}")
return ", ".join(labels) if labels else None
except Exception:
# Fails silently if the file is not a valid image or has no metadata
return None
100% vibecode btw