Nodes/comfyui_fk_server/FK_图片编码转换
ComfyUI Node

FK_图片编码转换

FK_Node turns images into base64 strings — boring glue, but it feeds the old FK texture editor

By juehackr·Created 2 years ago·Updated 7 months ago· 585
FK_图片编码转换
  • background
  • Depth
  • Texture
  • TextureMask
  • background
  • Depth
  • Texture

FK_图片编码转换 (image encoding conversion) is the least glamorous node in the juehackr/comfyui_fk_server pack and the easiest to understand: it takes images in and hands you base64 strings out. No editor, no web UI, no API calls. It exists for one reason - the pack's old texture editor (FK_ShowBaseNode) can't read IMAGE tensors, so something has to convert them into text it can render. This is that something.

How it works

Each input image gets encoded as a PNG and then base64-encoded into a string. Nothing leaves your machine; it's pure local conversion. The Texture output is the one with a bit of logic in it: if your texture image already has an alpha channel (four channels), it's encoded as-is. If it's a plain RGB image, the node takes your TextureMask, inverts it, and bakes it into the RGBA alpha channel - so where your mask is white, the texture arrives transparent. alpha = 1 − mask. That's how a texture without built-in transparency still sits correctly over the background when it reaches the editor.

The inputs and outputs that matter

Four inputs, three outputs, all of them obvious:

  • background, Depth, Texture (IMAGE) - the three layers the editor needs.
  • TextureMask (MASK, optional) - only meaningful when the texture has no alpha of its own. If the mask doesn't match the texture's dimensions, the node quietly falls back to encoding the texture without transparency, so keep sizes in sync.
  • Outputs background, Depth, Texture (STRING) - base64 PNGs. Wire these into the matching inputs on FK_ShowBaseNode. They're strings, not images, so PreviewImage won't show them; the display node is the thing that renders them.

Install and gotchas

It's the standard pack install - clone, pip install, restart:

cd ComfyUI/custom_nodes
git clone https://github.com/juehackr/comfyui_fk_server.git
pip install -r ComfyUI/custom_nodes/comfyui_fk_server/requirements.txt

Restart ComfyUI, and ComfyUI Manager works too (search "comfyui_fk_server"). Dependencies are light - just PyCryptodome and pybase64 - with no model downloads. Unlike the editor nodes, this one doesn't even need the pack's Node.js side server; it's self-contained Python.

Two practical notes. The base64 strings this produces are enormous - that's a big part of why the base64 pipeline is the "old" way and the newer FK_gjttNode2 takes IMAGE inputs directly. And don't bother manually copying these outputs anywhere; they're meant to travel over wires inside ComfyUI, not through your clipboard. It's a dull little utility, but if you're stuck with an older workflow built around FK_ShowBaseNode, it's the piece that makes the whole thing run.

CategoryFK_Nodes

Inputs (4)

NameTypeDefaultDescription
backgroundIMAGE
DepthIMAGE
TextureIMAGE
TextureMaskMASK

Outputs (3)

NameTypeDescription
backgroundSTRING
DepthSTRING
TextureSTRING