chore: auto-commit (61 archivos)
- docs/capabilities/INDEX.md - docs/capabilities/comfyui.md - python/functions/browser/comfyui_export_workflow_ui.md - python/functions/browser/comfyui_export_workflow_ui.py - python/functions/browser/comfyui_load_workflow_ui.md - python/functions/browser/comfyui_load_workflow_ui.py - python/functions/browser/comfyui_queue_prompt_ui.md - python/functions/browser/comfyui_queue_prompt_ui.py - python/functions/browser/comfyui_refresh_nodes_ui.md - python/functions/browser/comfyui_refresh_nodes_ui.py - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
---
|
||||
name: comfyui_read_png_metadata
|
||||
kind: function
|
||||
lang: py
|
||||
domain: ml
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def comfyui_read_png_metadata(png_path: str) -> dict"
|
||||
description: "Lee los parametros de generacion de un PNG generado por ComfyUI: extrae el chunk 'prompt' (API format) y resume modelo, seed, steps, cfg, sampler, scheduler, denoise y los prompts positivo/negativo siguiendo las conexiones del KSampler. Comparte el lector de chunks PNG con comfyui_import_workflow_png. Impura: lectura de disco, solo stdlib."
|
||||
tags: [comfyui, ml, png, metadata, workflow, stable-diffusion]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: error_go_core
|
||||
imports: []
|
||||
params:
|
||||
- name: png_path
|
||||
desc: "Ruta local del PNG generado por ComfyUI."
|
||||
output: "dict {ok, prompt, parameters, error}. prompt = workflow API format embebido (dict); parameters = {model, seed, steps, cfg, sampler_name, scheduler, denoise, positive, negative} extraido del KSampler y nodos conectados; error = motivo si ok=False."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/ml/comfyui_read_png_metadata.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
import sys, os
|
||||
sys.path.insert(0, os.path.join(os.environ["HOME"], "fn_registry", "python", "functions"))
|
||||
from ml.comfyui_read_png_metadata import comfyui_read_png_metadata
|
||||
|
||||
res = comfyui_read_png_metadata(os.path.expanduser("~/ComfyUI/output/comfy_00001_.png"))
|
||||
# res["ok"] == True
|
||||
# res["parameters"]["seed"] # ej. 20260623
|
||||
# res["parameters"]["model"] # ej. "dreamshaper_8.safetensors"
|
||||
# res["parameters"]["positive"] # el prompt positivo usado
|
||||
```
|
||||
|
||||
O lanzable directo con: `./fn run comfyui_read_png_metadata <ruta.png>`.
|
||||
|
||||
## Cuando usarla
|
||||
|
||||
Cuando quieras saber con que parametros se genero una imagen (que seed, modelo o
|
||||
prompt) sin abrir el grafo entero: para reproducir una imagen que te gusto, para
|
||||
catalogar outputs, o para comparar generaciones. Si necesitas el workflow completo
|
||||
para relanzarlo usa `comfyui_import_workflow_png` (devuelve el dict entero).
|
||||
|
||||
## Gotchas
|
||||
|
||||
- Impura: lee el archivo del disco. Un path inexistente o un PNG sin chunk
|
||||
'prompt' devuelve `{ok: False, error: ...}` (no lanza).
|
||||
- `parameters` se extrae del primer nodo cuyo class_type acaba en "KSampler" y de
|
||||
los CLIPTextEncode conectados a sus inputs positive/negative. Workflows muy
|
||||
custom (varios samplers, sin CheckpointLoaderSimple) pueden dar `parameters`
|
||||
parcial; el `prompt` completo siempre se devuelve para inspeccion manual.
|
||||
- Lee chunks tEXt/zTXt/iTXt; los PNG de la API REST solo traen 'prompt' (no
|
||||
'workflow'), suficiente para los parametros.
|
||||
- Marcada impura (no pura) porque hace I/O de disco, segun la regla de pureza del
|
||||
registry; la logica de parseo en si es determinista.
|
||||
Reference in New Issue
Block a user