Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Image-Text
ComfyUI Node

๐ŸฆŠ RS Image-Text

Hide a prompt inside a PNG and get it back later โ€” like a poor man's CivitAI workflow

By RaykosanยทCreated about a year agoยทUpdated 5 days agoยท 79
๐ŸฆŠ RS Image-Text
    • image
    • text
    โ—„modereadโ–บ
    โ—„filename_prefixCivitai/promptโ–บ
    โ—„text_inputโ–บ
    โ—„imageโ–พโ–บ

    You've downloaded an image from CivitAI, it has no embedded workflow, and the only thing you have is the picture. ๐ŸฆŠ RS Image-Text (LoadImageWithText) lets you tuck the prompt into the PNG file itself as a text chunk, then load that same PNG later and have the prompt come out the other side alongside the image. It's two utilities in one node: a writer and a reader.

    How it works

    The mechanism is the PNG text chunk. The node opens your image, and in write mode it attaches your text_input to a Description metadata field via Pillow's PngInfo, then saves the result to your ComfyUI output folder with the filename_prefix you set (default Civitai/prompt), auto-incrementing a counter so you never overwrite. JPEG input gets converted to PNG first, because JPEG has no place for that metadata. In read mode it opens the image, pulls the Description field back out, and returns it as a STRING alongside the image tensor.

    The README frames the use case precisely: you have an image and its prompt, but the image carries no workflow - common on CivitAI. Write the prompt in, and from then on that file carries its own caption. You can also use it as a plain Load Image replacement, since the image output is a normal tensor.

    Inputs that matter

    • mode - read (default) or write. Set to write when you want to save the prompt into the file.
    • filename_prefix - output prefix for write mode (tooltip: "Prefix to save to output (write only)").
    • text_input - the text to embed (write only).
    • image - file picker from your ComfyUI/input folder, same as the native loader.

    Outputs: image (IMAGE) and text (STRING) - the embedded caption, or empty in write mode (where it echoes back what you wrote).

    How to install

    Part of ComfyUI_RaykoStudio:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git
    

    Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI_RaykoStudio"). No extra dependencies beyond the pack's standard ones.

    Common issues

    • Text doesn't come back in read mode. The image you're reading was written by something else that didn't use the Description field - most tools write different metadata keys (like parameters or prompt), and this node only looks at Description. So it round-trips its own files, but won't read every PNG on the internet.
    • Forgetting to switch to write. Default is read; if you set the text and nothing happens, check the mode.
    • Where did my file go? Write mode saves to ComfyUI/output, not next to your input. Look in the output folder.

    The honest caveat: if your goal is to recover prompts from arbitrary downloaded images, this only works on files it (or something writing Description) created - it's not a universal prompt extractor. But as a self-contained "image + its prompt" bundle that survives file transfers, it's neat and zero-dependency.

    Category๐ŸฆŠ RaykoStudio

    Inputs (4)

    NameTypeDefaultDescription
    modeCOMBOread2 options: read, write
    filename_prefixSTRINGCivitai/promptPrefix to save to output (write only)
    text_inputSTRINGText to write (write only)
    imageCOMBO1 options: example.png

    Outputs (2)

    NameTypeDescription
    imageIMAGEโ€”
    textSTRINGโ€”