Nodes/comfyui_LLM_party/HTML to Image
ComfyUI Node

HTML to Image

Turn an HTML string into a real IMAGE output

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
HTML to Image
    • img
    html_str
    width800
    height600
    is_enabletrue

    LLMs are pretty good at writing HTML - a styled card, a little report, a table with some CSS. The problem is a string of markup isn't something you can drop into Save Image or preview in a ComfyUI graph. HTML to Image, from comfyui_LLM_party, closes that gap: hand it an HTML string, get back an actual IMAGE tensor you can wire into the rest of ComfyUI like any other image.

    How it works

    You give it markup and a target canvas size, and it renders that HTML into a bitmap at the resolution you asked for. It's a snapshot, not a live browser - think "screenshot of this HTML at this size," not "an embedded webpage." Complex CSS, web fonts pulled from the internet, or anything that depends on JavaScript executing may not render exactly the way it would in a full browser, since this is a one-shot render rather than an interactive page load.

    The inputs and outputs that matter

    • html_str - the markup to render. Commonly the output of the pack's own Markdown to HTML node, if you're starting from an LLM's markdown-formatted answer rather than hand-written HTML.
    • width / height (default 800 × 600) - the canvas size in pixels. Set these to match what you actually need; content that doesn't fit gets clipped or scaled depending on your CSS, same as any fixed-size render.
    • is_enable - the standard bypass toggle used throughout this pack.

    Output: img (IMAGE) - wire it straight into Save Image, Preview Image, or any other node downstream that expects a normal ComfyUI image.

    How to install it

    Search comfyui_LLM_party in ComfyUI Manager and install - restart after. Or clone it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heshengtao/comfyui_LLM_party.git
    

    Run pip install -r requirements.txt from inside the pack's folder using ComfyUI's own Python, then restart ComfyUI again. Rendering HTML to a bitmap generally leans on either a real (headless) browser engine or a system-level rendering binary rather than pure Python - the README doesn't spell out exactly which this node uses, but if it errors out on first use rather than misbehaving on a specific page, check the terminal traceback for a missing package or missing system binary before assuming your HTML is the problem.

    Common issues & troubleshooting

    Errors immediately, before it even looks at your HTML. That's almost always an installation gap rather than a bad markup string - HTML-to-image conversion typically needs something beyond plain pip packages (a browser binary, a rendering engine) to actually lay out CSS. Re-run the pip install -r requirements.txt step and read the terminal output carefully rather than the ComfyUI error toast, which usually won't show you the real missing dependency.

    Text or images inside the HTML don't show up. If your markup references external images by URL or web fonts, remember this is a single-shot render - anything that depends on a live network fetch completing at the right moment can be flaky. Inline what you can (base64 image data, embedded styles) if you need reliable output.

    Output looks stretched or cropped. That's width/height doing exactly what you told it - this node doesn't auto-fit content to the canvas, so match the size to your HTML's actual layout, or design the HTML around a fixed size you've already decided on.

    Category大模型派对(llm_party)/转换器(converter)

    Inputs (4)

    NameTypeDefaultDescription
    html_strSTRING
    widthINT800
    heightINT600
    is_enableBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    imgIMAGE