Nodes/ComfyUI_KubaNodes/kubakub regions from illustrator
ComfyUI Node

kubakub regions from illustrator

Regions straight from an Illustrator file (.ai saved PDF compatible, or .pdf). Every layer is read, hidden ones too. Line drawing layers are cut into the cells between their lines (<LAYER>_001.., grouped by shape), filled layers give one region per shape on top, a mask layer that covers the outside cuts the scope. Roles are guessed from the content and can be set per layer. The artboard maps onto the matrix with one uniform scale. Also outputs the line drawing, the placed photo and every layer as a mask.

By kubakubkub·Created 15 days ago·Updated 3 days ago· 9
kubakub regions from illustrator
  • matrix
  • scope
  • regions
  • preview
  • lines
  • reference
  • layer_masks
  • layer_names
  • scope_mask
  • regions_json
  • report
◄ai_file►
◄min_region_area400►
◄merge_small_regionstrue►
◄line_gap_close_px1►
◄split_shapestrue►
◄scale1.00►
◄layer_roles►
Categorykubakub/2d/regions

Inputs (9)

NameTypeDefaultDescription
ai_fileSTRINGPath of the .ai or .pdf (Explorer 'Copy as path' quotes are fine).
min_region_areaINT4000–100000000Cells and shapes smaller than this (pixels) are merged into a neighbour or dropped.
merge_small_regionsBOOLEANtrueOn: merge small cells into the neighbour with the longest border. Off: drop them.
line_gap_close_pxINT10–32Thicken the lines by this much first, so small gaps in the drawing don't leak one cell into the next.
split_shapesBOOLEANtrueShape layers: one region per separate shape (on) or one region per layer (off).
scaleFLOAT1.000.05–16Without matrix: pixels per point (1 = the artboard size in points).
matrixoptIMAGEThe matrix: sets the output size (the artboard must have its aspect) and is the preview background.
layer_rolesoptSTRINGOptional, one line per role: '<layer names or wildcards> = role'. Roles: lines (cells between the lines), shapes (one region per filled shape, on top), outside (not projected on), scope (only here), tag (tags the regions it covers), reference (photo output), ignore. Layers not listed get a role from their content (see the report).
scopeoptMASKPixels outside this mask are never part of a region.

Outputs (9)

NameTypeDescription
regionsKUBA_REGIONSLabel map + region table for the kubakub region nodes.
previewIMAGEOne colour per group, region borders and ids over the matrix, the photo or the drawing.
linesIMAGEThe line layers, white on black (a control image).
referenceIMAGEThe placed photo (reference layers); black if none.
layer_masksMASKEvery layer with paths as a mask (what it covers).
layer_namesSTRINGNames of layer_masks, one per line.
scope_maskMASK1 where regions may be.
regions_jsonSTRINGThe region table as text, with the layer list.
reportSTRINGEvery layer with its role, paths and covered pixels, and regions per layer.