Illustrator Paint by Numbers Script

Job ID: 39792709

Budget: €250 – €750 EUR

GOAL

Develop a robust Illustrator script that:

Automatically numbers each shape based on its fill color.

Places numbers inside the shapes (never outside or next to them).

Keeps numbers in separate layers, distinct from the original color/outline layers.

Builds and maintains a color / number palette.


Expected Output

After running the script, the document contains:

A master layer _PBN_NUMBERS_TOP always on top.

Within it, one sublayer per source layer: PBN_NUMBERS__<SourceLayerName>.

Numbers inside shapes, properly placed and sized.

A palette group _PBN_PALETTE rebuilt at the top-left of the active artboard.

A hidden store _PBN_STORE containing persistent color / number mappings.


Key Requirements

Inside placement only: numbers must always be placed inside the path area.

Safe placement:

Randomized trial positions with progressive shrink if needed.

Avoid edges (configurable padding).

Mark red if placement is unsafe (too close to edge / outside).

Adaptive repeats:

Small shapes: 1 number guaranteed.

Slim shapes (high aspect ratio): max 1.

Medium/large: up to 2–3 numbers with anti-spam (minimum distance enforced).

Font size: must never exceed 5 pt (min = 5 pt).

Batch mode: configurable (e.g., 500 shapes per run). Add a PBN_DONE tag to processed shapes for resume.

Performance: must handle documents with several thousand shapes (>4000).

Document traversal:

Recurse into sublayers and groups.

Skip special layers (_PBN_NUMBERS_TOP, _PBN_STORE, PBN_NUMBERS__).

Z-order: _PBN_NUMBERS_TOP must always be brought to front at the end.

Compatibility: robust against locked/hidden layers, compound paths, nested groups.


End-of-run Report

Shapes seen / processed.

Number of palette entries.

Confirmation that numbers are placed in sublayers under _PBN_NUMBERS_TOP.


Deliverables

1 main script (ExtendScript .jsx or UXP plugin).

Short README explaining installation, parameters, and expected layer structure.

Optional: a small utility script for reorganizing/moving numbers if needed.