MCPcopy Create free account
hub / github.com/32comic/image2pixel-web / split

Method split

web/js/algorithms.js:156–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154 return labToRgb(L / n, a / n, b / n);
155 }
156 split() {
157 if (this.pixels.length < 2) return null;
158 const ch = this.splitChannel;
159 this.pixels.sort((a, b) => a[ch] - b[ch]);
160 const mid = Math.floor(this.pixels.length / 2);
161 return [new LabBox(this.pixels.slice(0, mid)), new LabBox(this.pixels.slice(mid))];
162 }
163 }
164
165 let boxes = [new LabBox(labPixels)];

Callers 2

medianCutGetPaletteFunction · 0.45
medianCutGetPaletteInLabFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected