Pt To Image
The bridge that lets Pt tensors talk to the rest of ComfyUI
- tens
- image
ComfyUI-Pt-Wrapper speaks its own dialect. Its tensors are plain PyTorch tensors, which means most of ComfyUI's standard image nodes won't accept them - those expect the IMAGE type, and the two aren't interchangeable. Pt To Image is the handshake between the worlds: it takes a TENSOR and re-labels it as an IMAGE so you can feed it into ComfyUI's own preview, save, and downstream nodes.
One input (tens, TENSOR), one output named image (IMAGE). And here's the thing that trips people up: this node does not rearrange your data. It's a cast, full stop - the underlying values are untouched. So whether the result looks right depends entirely on the layout of the tensor you feed it.
ComfyUI images live in HWC layout - height, width, channels - with values in the 0–1 float range. PyTorch models, on the other hand, think in CHW: channel, height, width. If your tensor came out of a model's forward pass in CHW and you wire it straight into Pt To Image, you'll get a bizarre rotated-to-hell-looking mess of a preview, because ComfyUI will interpret your channel axis as height. That's exactly what PtToImageTranspose is for - it casts and permutes CHW to HWC in one step. If your data is already HWC (say, from a PtToRgbTensors reconstruction or a dataset loader that emits HWC), plain Pt To Image is the right node.
The other classic mistake: feeding it raw uint8 or unnormalized values. ComfyUI expects 0–1 floats. If your tensor is 0–255 bytes, cast to float and divide by 255 first, or everything you preview will be blown out to white.
Install
ComfyUI Manager (search "ComfyUI-Pt-Wrapper"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Restart ComfyUI. The pack's requirements are the heavy Hugging Face stack (transformers, datasets, peft, accelerate, scikit-learn, pandas, seaborn, matplotlib, gensim, sentencepiece). No model downloads.
Common issues
Wrong-looking preview? Check layout first, then range. If the image looks scrambled, you've got CHW data in a node that expects HWC - swap in PtToImageTranspose. If it looks washed out or black, check the value range. Both are input problems, not node problems, and this bridge node will pass through whatever you hand it, faithfully and uselessly if you ask it to.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| tens | TENSOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |