Nodes/ComfyUI_KimNodes/🍒Icon_Position_Cropper / 图标位置裁剪
ComfyUI Node

🍒Icon_Position_Cropper / 图标位置裁剪

Icon_Position_Cropper slices the icon sheet back into individual icons by row and column

By wjl0313·Created 2 years ago·Updated 12 months ago· 54
🍒Icon_Position_Cropper / 图标位置裁剪
  • 图片
  • 位置数据
  • 裁切后图像
起始列号0
终止列号8
行号8

Seamless_Icon_Generator gives you a full sheet of icons on a background. Icon_Position_Cropper is the other half of that pair: it takes the sheet and the position data the generator produced, and cuts out just the region you want - a range of columns on a given row - so you can pull individual icons back out of the composite.

Think of it as a smart crop that's indexed by layout rather than by pixels. You don't type coordinates; you say "give me columns 0 through 8 on row 8" and the node works out the rectangle from the recorded icon centers. If you're generating icon sheets for a game or UI kit, this is the extraction step that turns one big render into usable individual assets.

How it works

You feed it 图片 (the generated sheet), 位置数据 (the 图标位置数据 DATA output from Seamless_Icon_Generator), and three integers: 起始列号 (start column), 终止列号 (end column), and 行号 (row). The position data is a list of dicts, each with keys 列号 (column), 重复组号 (row group), x, y, , - exactly what the generator writes. The node scans the data for the four corner markers: top-left and top-right at 重复组号 0 on your start and end columns, bottom-left and bottom-right at 重复组号 行号 on those same columns. It takes the center of each corner icon, and the rectangle spanning those four centers is the crop.

It's tightly coupled to the generator's data format - that's by design. Feed it position data from anything else and it won't find the corner keys.

The inputs that matter

  • 图片 - the composite sheet from Seamless_Icon_Generator.
  • 位置数据 - its DATA output. Don't guess; connect the wire.
  • 起始列号 / 终止列号 - the column range you want (e.g. 0 to 8).
  • 行号 - the row group (重复组号) to slice.

Output: 裁切后图像, an IMAGE crop. It batch-processes, so a multi-frame input gets cropped frame by frame.

Installation

Standard KimNodes pack install - Manager → search "ComfyUI_KimNodes" → Install → Restart, or git clone https://github.com/wjl0313/ComfyUI_KimNodes into custom_nodes. Pure PIL/torch, no extra dependencies.

Common issues

  • "未找到所需的四个角落点" (four corner points not found) - the requested column range or row doesn't exist in the position data. Count your columns from 0, and remember 行号 counts 重复组号, not every individual icon. If 每组数量 was 1, each column's row numbering may not match your expectation.
  • Crop is slightly off - the node crops to the centers of the corner icons, so the cut includes part of the corner icons themselves. That's expected behavior for pulling the interior region; nudge the column range to include the corner columns you want cropped in or out.
  • Wrong columns cropped - 列号 in the data refers to repeat-groups of columns, not per-icon column positions. Check the generator's output structure first.

It's a niche pairing - generator + this cropper - but if you're on the icon-sheet workflow, the two together beat hand-measuring crop boxes by a mile.

Category🍒 Kim-Nodes/🧩Icon Processing | 图标处理

Inputs (5)

NameTypeDefaultDescription
图片IMAGE
位置数据DATA
起始列号INT00–100
终止列号INT80–100
行号INT80–100

Outputs (1)

NameTypeDescription
裁切后图像IMAGE