Hanyu Liu

Production tooling / colour science / halftoning / agent workbench

Screen Print Separation

A screen prints a solid: ink or no ink. Turning a customer's artwork into something a press can run means deciding how many spot inks, which ones, whether a dark shirt needs a white underbase, and how to screen each plate so the dots hold on the mesh. This workbench does that end to end — an agent proposes the plan with its reasons, the operator can change anything, and the export is the set of files the shop actually uses: spot-channel PSD, separation PDF, one-bit films and a production ticket.

StatusPrototype v3.0
Software tests on synthetic artwork; not yet validated on real orders or at the press
Built forThe in-house print shop of a garment manufacturer, where gradient and photographic separations were going to an outside vendor
FormLocal web workbench: a standard-library Python server with numpy and Pillow, native JavaScript front end, no build step, shareable on the shop LAN. Grew out of a Photoshop script (section 05)
PeriodSeptember – October 2026
01

The workbench, recorded

Real interface, real pipeline, synthetic artwork made for this demo. Drop a file with the fabric colour and print width; the agent analyses the art, recommends a mode and plate count with reasons; preview the separation; export the production files.

Upload → agent analysis → preview → plates → compare → quality check → export. Two waits are shortened: separation preview (about five seconds for three plates at 28 cm) and the full-resolution export (about two and a half minutes for seven films at 720 dpi). Everything else is real time.
Separation workbench with a gradient wordmark split into three plates
Gradient wordmark on white. The agent reads the artwork as a gradient with three spot inks (confidence 80%), explains why solid plates would need more colours, warns that 149 ppi is low for the print size, and matches each ink to the shop's ink library by ΔE2000.
02

What comes out

Each export is a versioned folder. The films below are the actual one-bit TIFFs from the illustration job: registration marks, a dot-gain scale, and a label with job, plate, ink, line frequency and mesh.

Seven one-bit films: underbase white, yellow, grey red, red, green, blue, highlight white
Seven films at 720 dpi, 36 × 36 cm each, screened at 50 lpi / 22.5° with complementary dots so plates never overlap in the same cell. Shown reduced; the originals are 10,206 px square.
Printable production ticket
The production ticket, printable on A4: print order, ink codes, mesh, line frequency and angle, coverage, flash cure, quality notes, and signature lines for design, exposure, ink mixing and the press operator.

The file set

  • Spot-channel PSD — one spot channel per plate, named print order + ink + code, coloured with the ink colour, so a RIP or Photoshop can screen it with the shop's own parameters.
  • Separation PDF — each plate a /Separation object with overprint, opened in Illustrator or Acrobat, sent straight to a RIP.
  • Films — pre-screened one-bit TIFFs, ready for the film printer, mirrored if the shop exposes that way.
  • Ticket — the HTML above.
  • Simulation PNG and manifest.json — every parameter, palette entry and quality result, machine-readable for an ERP or MES.

The PSD, PDF and TIFF writers are written from scratch on top of numpy — no imaging library with licensing strings attached, and every byte of a spot channel or a Separation colour space is under control.

03

Under the hood

Two data structures carry the whole system: Artwork, what was read in, and Separation, the plates that came out. A new input format touches only the loader; a new output format reads only a Separation; a new mode is one branch in the separator.

Artwork inPNG · JPG · TIFF · PSD · PDF · AIRead + colourICC → sRGB, alpha, dpiRemove backgroundalpha channel or edge flood fillAnalyseflat / gradient / texture · colours · ppiUnderbase + trapwhite by ink depth, chokedSeparate4 modes · ≤ 2 plates per pixelPalettegreedy by ΔE · ink library matchAdvisorplan + reasons + confidenceScreenranked threshold matrix · dot gainQuality checkstations · ppi · ΔE · lines · dotsPreviewsimulation · plates · 1:1 zoomExportPSD · PDF · films · ticket · manifestOperator can change anything re-preview after any change
Two structures carry it: Artwork in, Separation out. The agent's plan is a proposal the operator edits; preview and quality check run on every change; export renders everything at full resolution.

Four modes, one separator

  • Solid spot — logos and flat art: one 100% plate per ink, automatic trapping.
  • Gradient spot halftone — a few spot inks with blends: at most two plates carry ink at any point, so transitions stay clean.
  • Simulated process — photographs and complex illustrations, especially on dark fabric: soft decomposition plus underbase and highlight white.
  • Index — many bright colours, loose registration: square diffusion dots, one ink per cell.

The decomposition

Each ink with the fabric colour forms a segment. A pixel is projected onto every segment in Yule–Nielsen space (reflectance to the half), the residual is measured in Lab, and a softmin weights the segments. Adjacent plates sum to 100%, and no pixel needs more than two inks — which is what a press can register.

Choosing inks

Candidates are k-means centres, the most saturated colour in each hue band, and the darkest and lightest pixels. Inks are added greedily on reconstruction ΔE, swapped to improve, then pushed outward toward the pixels they alone explain, so gradient endpoints do not go grey. The same error curve suggests the plate count: stop when one more plate buys less than 1.5 ΔE.

Dark fabric

Underbase is the sum of each plate's coverage times the white that ink needs — 100% under light inks, 35% under dark — then eroded in greyscale so it never peeks out. Solid mode uses the binary union, choked.

Screening

A 256 × 256 ranked threshold matrix: coverage equals the black area it produces, and each film pixel samples coverage bilinearly, so edges stay crisp. Complementary dots share one grid across plates; print order assigns each plate a band of thresholds in the same cell, so plates do not stack, and the gain curve is applied to cumulative coverage.

What the agent is allowed to do

Recommend, with reasons. Every parameter stays editable; a plan — from the rule advisor today, from a model later — must pass validation against the press's stations and mesh presets before it is applied. The interface shows the recommended mode with a dot, not a lock.

Runtime, as recorded

On the synthetic jobs in the recording, running in a cloud container: three-plate preview at 28 cm in 4.7 s; seven-plate preview at 32 cm in 12.4 s; the full seven-film export at 720 dpi in 151 s. Core dependencies are numpy, Pillow and pypdfium2; it runs on a Mac by double-click.

04

Decisions that shaped it

Program and data apartupgrades never touch jobs
Jobs, the ink library and production settings live in a data folder — on a shared drive if the shop wants — and the program folder can be replaced whole. Settings merge by adding new keys, never overwriting old values.
No heavy imaging or PDF dependenciesand no licence risk
PSD, PDF and TIFF output are written from first principles rather than pulling in an AGPL PDF library. Reading PSD/PSB — RLE, 16-bit, CMYK, unpremultiplied alpha — is also in-house.
The agent advisesit does not override
A plan is a suggestion with reasons and a confidence; alternatives are offered; "re-analyse" is a button. The shop's constraints are data the agent reads, not rules it owns.
Every export traceableversion folder + manifest + log
Each export is a dated version with its parameters, palette and quality results; earlier versions stay downloadable; the job keeps an operation log.
Screen as the truthfilm view = ink view
A plate is shown black-on-white exactly as the film will be; the simulation is labelled as approximate and the ticket says colours are display references, not ink recipes.
05

Where it started: the gradient script

The first version was a Photoshop script that split a linear gradient into complementary spot plates at a line frequency matched to the mesh. The algorithm runs here in the browser on a synthetic gradient; the workbench above generalises it to arbitrary artwork.

Source gradient (synthetic)
Reconstruction: the plates overprinted, as a check — toggle layers to see what each plate contributes

Coverage per plate — black is 100% ink

Halftone plates — shown at 4× magnification, angles stepped by 30° to limit moiré

v1.1compatibility
The gradient tool call failed on some Photoshop versions; rebuilt the band generation with selection + solid fill only.
v1.2halftone export
Fixed a wrong enum in the bitmap-halftone conversion that broke the optional pre-screened output.
v1.3edge case
The last plate rendered solid black: a zero-width selection on the final node made Photoshop fill the whole canvas. Guarded the zero-width case.
v2Python, command line
Inverse-distance decomposition on PNG/JPG; every plate had stray dots everywhere. Replaced by segment decomposition in v3.
v3the workbench
Four modes, dark-fabric underbase, ranked threshold screening, self-written PSD/PDF/TIFF, quality checks, ink library, job library, versioned exports.
Before any of ita software evaluation
Wrote the comparison of commercial separation tools (plug-in vs cloud, trial-first, confirm the exposure unit's file format before choosing) the team used to decide whether to buy or build.

What software can validate, and what only a press can

A separation is a prediction about ink on cloth. Some of that prediction can be checked on a screen; the rest is physics and has to be checked on a strike-off. Knowing which is which is the difference between a tool and a toy.

Validated in software

Geometry, colour math and files

  • ΔEThe simulated print against the artwork, per pixel and in aggregate, in Lab with ΔE2000.
  • platesPlate count, at most two inks per pixel, coverage per plate, trap width, underbase choke.
  • screenDot structure from the ranked threshold matrix: no dot below the printable minimum, no moiré between angles.
  • filesThe production set opens where it must: layered PSD with spot channels, one-bit films at output resolution, the ticket and manifest.
  • regressThe same artwork separates the same way every run; a change is a diff, not a surprise.
Needs a press

Ink, mesh, fabric and hands

  • gainReal dot gain on this fabric with this mesh and squeegee: the tone curve in the tool is a model until it is measured.
  • opacityHow much an ink hides the ground, and therefore whether the white underbase is enough, too much, or wrong in places.
  • orderPrint order and flash between colours: trapping that is correct on screen can still smear or lift.
  • specialsPuff, metallic, high-density and discharge inks behave in ways the simulation does not attempt.
  • eyeWhether the operator, holding the strike-off next to the artwork under shop light, accepts it.

The next step is therefore not more features: it is one real order through the pipeline with the operator's feedback closing the loop, and the measured tone curve written back into the tool.

06

Status, honestly

Software-test stage. Everything on this page ran on synthetic artwork made for the demo. The separations have not been exposed, printed or compared with a strike-off, and the quality scores are the tool's own checks, not shop sign-off. The next step is a real order through the pipeline with the press operator's feedback closing the loop.

Roadmap, as planned

  • Native vectors: read spot colours and paths from AI/PDF, output vector-edged plates.
  • PSD layers and existing spot channels, so customer-separated files can be checked rather than redone.
  • Colour management: measured ink and fabric Lab from a spectrophotometer; calibrate the print model against proofs.
  • A model-backed advisor behind the same validation gate: analysis JSON and thumbnail in, plan JSON out, never beyond the press's constraints.
  • Multi-user deployment: accounts, design → review → exposure hand-offs, database-backed job library, audit log.