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.
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)
| Name | Type | Default | Description |
|---|---|---|---|
| ai_file | STRING | Path of the .ai or .pdf (Explorer 'Copy as path' quotes are fine). | |
| min_region_area | INT | 4000–100000000 | Cells and shapes smaller than this (pixels) are merged into a neighbour or dropped. |
| merge_small_regions | BOOLEAN | true | On: merge small cells into the neighbour with the longest border. Off: drop them. |
| line_gap_close_px | INT | 10–32 | Thicken the lines by this much first, so small gaps in the drawing don't leak one cell into the next. |
| split_shapes | BOOLEAN | true | Shape layers: one region per separate shape (on) or one region per layer (off). |
| scale | FLOAT | 1.000.05–16 | Without matrix: pixels per point (1 = the artboard size in points). |
| matrixopt | IMAGE | The matrix: sets the output size (the artboard must have its aspect) and is the preview background. | |
| layer_rolesopt | STRING | Optional, 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). | |
| scopeopt | MASK | Pixels outside this mask are never part of a region. |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| regions | KUBA_REGIONS | Label map + region table for the kubakub region nodes. |
| preview | IMAGE | One colour per group, region borders and ids over the matrix, the photo or the drawing. |
| lines | IMAGE | The line layers, white on black (a control image). |
| reference | IMAGE | The placed photo (reference layers); black if none. |
| layer_masks | MASK | Every layer with paths as a mask (what it covers). |
| layer_names | STRING | Names of layer_masks, one per line. |
| scope_mask | MASK | 1 where regions may be. |
| regions_json | STRING | The region table as text, with the layer list. |
| report | STRING | Every layer with its role, paths and covered pixels, and regions per layer. |