Pt Crop
The node that will teach you ComfyUI images aren't what this pack wants
- tens
- TENSOR
Pt Crop cuts a tensor down to a target height x width, and it's the node that will introduce you to the pack's most important concept: a ComfyUI IMAGE is not the same thing as this pack's TENSOR. ComfyUI images are (batch, height, width, channels). This pack's tensor ops expect channels-first - (c, h, w) for a single image or (b, c, h, w) for a batch. Wire an image straight into this node and you'll get a runtime error about rank or an output that's silently nonsense.
The fix is a standard two-hop dance that you'll use for every image-processing node in this pack:
PtFromImage- casts the ComfyUIIMAGEto aTENSOR(a pure cast, layout unchanged).PtPermutewith[0, 3, 1, 2]- reorder(b, h, w, c)to(b, c, h, w).- Crop.
PtPermutewith[0, 2, 3, 1]- back to(b, h, w, c).PtToImage- cast back.
(Note: the pack's own docs list the permute indices in a couple of spots with the forward/backward pair swapped - trust the shapes, not the memory. PtShowSize is your friend when in doubt.)
Inputs
tens- aTENSORin(c, h, w)or(b, c, h, w)layout.height- target crop height (INT, 1–16384).width- target crop width (INT, 1–16384).
Output: the cropped TENSOR.
Where people get burned
Two things. First, the crop size must be smaller than the image - the node throws "Specified crop size exceeds tensor dimensions" if you ask for more than you have. Second, despite the source containing what looks like centering math, the bounds check guarantees that math always resolves to zero - meaning the crop is taken from the top-left corner, not the center. If you expected a center crop, you'll be cropping faces off subjects until you notice. The pack has no built-in center-crop helper here, so if you need one, build it from PtCrop + PtPermute + some index math yourself.
Installing it
Ships in ComfyUI-Pt-Wrapper by Hide Inada (HowToSD). ComfyUI Manager → search "ComfyUI-Pt-Wrapper" → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Pt-Wrapper
Heavy dependency tree (transformers, datasets, scikit-learn, scipy, gensim, pandas, peft, accelerate...). If Manager's install fails, pip install -r requirements.txt in the clone. No model downloads for this node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| tens | TENSOR | — | |
| height | INT | 01–16384 | — |
| width | INT | 01–16384 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| TENSOR | TENSOR | — |