ComfyUI Node

Pt From Image

The adapter between ComfyUI pixels and PyTorch math

By HowToSD·Created about a year ago·Updated about a year ago· 7
Pt From Image
  • image
  • TENSOR

Pt From Image looks like it does nothing, which is exactly the point. It takes an IMAGE and hands it back as a TENSOR - the same data, just wearing a different socket type. In this pack, IMAGE and TENSOR are deliberately separate types: images flow through ComfyUI's standard image graph, while tensors flow through the PyTorch math and training graph. This node is the bridge between them. Without it, you can't run Pt-Wrapper operations on pixels at all.

How it works

Mechanically it's a pass-through: the node receives the image tensor and returns it unchanged. ComfyUI images already are PyTorch tensors - shape (batch, height, width, channels) in float, roughly 0–1 range - so nothing needs converting. What changes is the type label. Once it's a TENSOR, it plugs into Pt Float Create's friends: Pt Mean, Pt Mul, Pt Reshape, Pt MatMul, any of the arithmetic or processing nodes, and ultimately a model node for no-code image classification.

The practical workflow the author's docs push: load an image, convert it here, then feed it through the pack's tensor ops and into a Ptv Dataset or a training/prediction node. If you've used the Dog vs. Cat example workflow, this node is on the path from image to model.

The one input

  • image - a standard ComfyUI IMAGE. There's genuinely nothing else to configure. If your image is in LATENT form instead, use Pt From Latent; if it's a numpy array, Pt From Numpy.

What to watch for

Because this node is a type bridge, the classic failure is wiring the wrong conversion: feeding a latent (a dict with a samples key) into something expecting a raw tensor, or trying to use an IMAGE-typed output directly in a tensor socket. If a connection simply won't attach, check which conversion node produced the tensor. Also remember the tensor keeps ComfyUI's (B, H, W, C) layout - the pack's model nodes expect that layout, so resist the urge to transpose on the way in unless you know what you're doing.

Installing it

It's part of ComfyUI-Pt-Wrapper:

  • ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Pt-Wrapper" → Install → restart.
  • Or cd ComfyUI/custom_nodes && git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper and restart.

Heads up: the pack's requirements.txt pulls in a big ML stack (transformers, datasets, peft, accelerate, scikit-learn, scipy, gensim, sentencepiece...), so the first startup after install is slow. No model downloads needed for this node - it's just a type cast. The pack is a niche educational project by HowToSD; expect little community help online and lean on the repo's docs/reference/ or an issue for anything that breaks.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
TENSORTENSOR