@xprite/pixelate 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ import { clampByte } from "./base.js";
2
+ import { gaussianBlur } from "./float-image.js";
1
3
  import { oklabToRgb, rgbToOklab } from "./quantization.js";
2
4
  import { PixelationDither } from "./types.js";
3
5
  /**
@@ -21,6 +23,9 @@ const NEAR_DUPLICATE_OKLAB_DISTANCE = 0.03;
21
23
  const SEED_WEIGHT = 0.25;
22
24
  /** Cluster pull = count^PULL_WEIGHT, so large flat areas do not drag centroids off rare colours. */
23
25
  const PULL_WEIGHT = 0.5;
26
+ const SALIENCY_SIGMA = 2.5;
27
+ const SALIENCY_BOOST = 3.5;
28
+ const SALIENCY_CHROMA_WEIGHT = 2.4;
24
29
  const MAX_ITERATIONS = 32;
25
30
  const CHANNELS = 4;
26
31
  /**
@@ -32,9 +37,66 @@ const BAYER_8 = [
32
37
  52, 20, 62, 30, 54, 22, 3, 35, 11, 43, 1, 33, 9, 41, 51, 19, 59, 27, 49, 17, 57, 25, 15, 47, 7,
33
38
  39, 13, 45, 5, 37, 63, 31, 55, 23, 61, 29, 53, 21,
34
39
  ];
35
- const distance = (a, b) => Math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2 + (a[2] - b[2]) ** 2);
36
- const clampByte = (value) => Math.max(0, Math.min(255, Math.round(value)));
37
- function histogram(image) {
40
+ const distance = (a, b, chromaWeight = 1) => Math.sqrt((a[0] - b[0]) ** 2 + chromaWeight * ((a[1] - b[1]) ** 2 + (a[2] - b[2]) ** 2));
41
+ /** Local OKLab brightness + chroma distinctiveness so rare focal accents win palette slots. */
42
+ function computePixelSalience(image, shades, index) {
43
+ const { width: w, height: h } = image;
44
+ const n = w * h;
45
+ const L = new Float32Array(n);
46
+ const A = new Float32Array(n);
47
+ const B = new Float32Array(n);
48
+ let meanL = 0;
49
+ let meanA = 0;
50
+ let meanB = 0;
51
+ let vis = 0;
52
+ for (let i = 0; i < n; i++) {
53
+ const si = index[i];
54
+ if (si < 0)
55
+ continue;
56
+ const ok = shades[si].oklab;
57
+ L[i] = ok[0];
58
+ A[i] = ok[1];
59
+ B[i] = ok[2];
60
+ meanL += ok[0];
61
+ meanA += ok[1];
62
+ meanB += ok[2];
63
+ vis += 1;
64
+ }
65
+ if (vis > 0 && vis < n) {
66
+ meanL /= vis;
67
+ meanA /= vis;
68
+ meanB /= vis;
69
+ for (let i = 0; i < n; i++) {
70
+ if (index[i] < 0) {
71
+ L[i] = meanL;
72
+ A[i] = meanA;
73
+ B[i] = meanB;
74
+ }
75
+ }
76
+ }
77
+ const L2 = gaussianBlur(L, w, h, SALIENCY_SIGMA, 2.5);
78
+ const A2 = gaussianBlur(A, w, h, SALIENCY_SIGMA, 2.5);
79
+ const B2 = gaussianBlur(B, w, h, SALIENCY_SIGMA, 2.5);
80
+ const sal = new Float32Array(n);
81
+ let maxS = 1e-6;
82
+ for (let i = 0; i < n; i++) {
83
+ if (index[i] < 0)
84
+ continue;
85
+ const s = Math.abs(L[i] - L2[i]) * 1.4 +
86
+ Math.hypot(A[i] - A2[i], B[i] - B2[i]) * 4.5 +
87
+ Math.hypot(A[i], B[i]) * 1.2;
88
+ sal[i] = s;
89
+ if (s > maxS)
90
+ maxS = s;
91
+ }
92
+ const invMax = 1 / maxS;
93
+ for (let i = 0; i < n; i++) {
94
+ if (index[i] >= 0)
95
+ sal[i] = 1 + SALIENCY_BOOST * (sal[i] * invMax) ** 1.25;
96
+ }
97
+ return sal;
98
+ }
99
+ function histogram(image, useSaliency) {
38
100
  const { data } = image;
39
101
  const pixels = data.length / CHANNELS;
40
102
  const seen = new Map();
@@ -53,15 +115,28 @@ function histogram(image) {
53
115
  rgb: [data[o], data[o + 1], data[o + 2]],
54
116
  oklab: rgbToOklab(data[o], data[o + 1], data[o + 2]),
55
117
  count: 0,
118
+ salienceSum: 0,
56
119
  });
57
120
  }
58
121
  shades[at].count += 1;
59
122
  index[i] = at;
60
123
  }
124
+ if (useSaliency && image.width * image.height >= 16 && shades.length > 2) {
125
+ const sal = computePixelSalience(image, shades, index);
126
+ for (let i = 0; i < pixels; i++) {
127
+ const si = index[i];
128
+ if (si >= 0)
129
+ shades[si].salienceSum += sal[i];
130
+ }
131
+ }
132
+ else {
133
+ for (const shade of shades)
134
+ shade.salienceSum = shade.count;
135
+ }
61
136
  return { shades, index };
62
137
  }
63
138
  /** Greedy leader clustering, heaviest first: only colours within the OKLab threshold share a group. */
64
- function mergeNearDuplicates(shades) {
139
+ function mergeNearDuplicates(shades, chromaWeight = 1) {
65
140
  const order = shades.map((_, i) => i).sort((a, b) => shades[b].count - shades[a].count || a - b);
66
141
  const groups = [];
67
142
  const threshold2 = NEAR_DUPLICATE_OKLAB_DISTANCE ** 2;
@@ -73,7 +148,7 @@ function mergeNearDuplicates(shades) {
73
148
  const dx = oklab[0] - leader[0];
74
149
  const dy = oklab[1] - leader[1];
75
150
  const dz = oklab[2] - leader[2];
76
- const d2 = dx * dx + dy * dy + dz * dz;
151
+ const d2 = dx * dx + chromaWeight * (dy * dy + dz * dz);
77
152
  if (d2 <= bestDistance2) {
78
153
  bestDistance2 = d2;
79
154
  best = g;
@@ -92,9 +167,11 @@ function mergeNearDuplicates(shades) {
92
167
  function toPoints(shades, groups) {
93
168
  return groups.map((members) => {
94
169
  let count = 0;
170
+ let salience = 0;
95
171
  const sum = [0, 0, 0];
96
172
  for (const m of members) {
97
173
  count += shades[m].count;
174
+ salience += shades[m].salienceSum;
98
175
  for (let c = 0; c < 3; c++)
99
176
  sum[c] += shades[m].oklab[c] * shades[m].count;
100
177
  }
@@ -102,23 +179,24 @@ function toPoints(shades, groups) {
102
179
  return {
103
180
  oklab,
104
181
  count,
182
+ salience: count > 0 ? salience / count : 1,
105
183
  members,
106
184
  };
107
185
  });
108
186
  }
109
187
  /** Weighted farthest-point seeding: start from the commonest colour, then keep adding the colour
110
- * that is farthest from every seed so far (lightly favouring frequent ones). */
111
- function seed(points, k) {
188
+ * that is farthest from every seed so far (weighted by count and local visual salience). */
189
+ function seed(points, k, chromaWeight) {
112
190
  let first = 0;
113
191
  for (let i = 1; i < points.length; i++)
114
192
  if (points[i].count > points[first].count)
115
193
  first = i;
116
194
  const seeds = [points[first].oklab];
117
- const nearest = points.map((p) => distance(p.oklab, seeds[0]));
195
+ const nearest = points.map((p) => distance(p.oklab, seeds[0], chromaWeight));
118
196
  while (seeds.length < k) {
119
197
  let pick = -1, pickScore = 0;
120
198
  for (let i = 0; i < points.length; i++) {
121
- const score = nearest[i] * points[i].count ** SEED_WEIGHT;
199
+ const score = nearest[i] * points[i].count ** SEED_WEIGHT * points[i].salience ** 0.5;
122
200
  if (score > pickScore) {
123
201
  pickScore = score;
124
202
  pick = i;
@@ -128,12 +206,12 @@ function seed(points, k) {
128
206
  break;
129
207
  seeds.push(points[pick].oklab);
130
208
  for (let i = 0; i < points.length; i++)
131
- nearest[i] = Math.min(nearest[i], distance(points[i].oklab, points[pick].oklab));
209
+ nearest[i] = Math.min(nearest[i], distance(points[i].oklab, points[pick].oklab, chromaWeight));
132
210
  }
133
211
  return seeds;
134
212
  }
135
- function cluster(points, k) {
136
- const centers = seed(points, k);
213
+ function cluster(points, k, chromaWeight) {
214
+ const centers = seed(points, k, chromaWeight);
137
215
  const assign = new Int32Array(points.length).fill(-1);
138
216
  // Flatten points and centres into typed arrays so the assignment loop avoids
139
217
  // per-access bounds checks and object property lookups in the inner loop.
@@ -144,7 +222,7 @@ function cluster(points, k) {
144
222
  pointData[i * 3] = points[i].oklab[0];
145
223
  pointData[i * 3 + 1] = points[i].oklab[1];
146
224
  pointData[i * 3 + 2] = points[i].oklab[2];
147
- pointWeight[i] = points[i].count ** PULL_WEIGHT;
225
+ pointWeight[i] = points[i].count ** PULL_WEIGHT * points[i].salience;
148
226
  }
149
227
  const centerData = new Float64Array(centers.length * 3);
150
228
  const writeCenter = (c, value) => {
@@ -165,7 +243,7 @@ function cluster(points, k) {
165
243
  const dx = px - centerData[c * 3];
166
244
  const dy = py - centerData[c * 3 + 1];
167
245
  const dz = pz - centerData[c * 3 + 2];
168
- const d = dx * dx + dy * dy + dz * dz;
246
+ const d = dx * dx + chromaWeight * (dy * dy + dz * dz);
169
247
  if (d < bestDistance) {
170
248
  bestDistance = d;
171
249
  best = c;
@@ -206,10 +284,10 @@ function paletteOklabs(palette) {
206
284
  rgb: visible.map((c) => c),
207
285
  };
208
286
  }
209
- function nearestPaletteRgb(oklab, oklabs, rgb) {
287
+ function nearestPaletteRgb(oklab, oklabs, rgb, chromaWeight = 1) {
210
288
  let best = 0, bestDistance = Infinity;
211
289
  for (let i = 0; i < oklabs.length; i++) {
212
- const d = distance(oklab, oklabs[i]);
290
+ const d = distance(oklab, oklabs[i], chromaWeight);
213
291
  if (d < bestDistance) {
214
292
  bestDistance = d;
215
293
  best = i;
@@ -319,35 +397,41 @@ function ditherToPalette(image, palette, dither) {
319
397
  ? orderedBayer8ToPalette(image, palette)
320
398
  : floydSteinbergToPalette(image, palette);
321
399
  }
322
- /** Build the reduced RGB palette (k-means or the given list); null when the image already fits. */
323
- function buildPalette(shades, options) {
324
- if (options.palette)
325
- return paletteOklabs(options.palette).rgb;
326
- const groups = mergeNearDuplicates(shades);
400
+ /** Cluster shades into a reduced OKLab palette (shared by flat remap and dither paths). */
401
+ function clusterShades(shades, options, chromaWeight) {
402
+ const mergeChromaWeight = options.adaptive ? 1 : chromaWeight;
403
+ const groups = mergeNearDuplicates(shades, mergeChromaWeight);
327
404
  const colors = options.adaptive
328
405
  ? Math.min(groups.length, MAX_COLORS)
329
406
  : Math.max(MIN_COLORS, Math.min(MAX_COLORS, Math.round(options.colors ?? DEFAULT_COLORS)));
330
407
  if (shades.length <= colors)
331
408
  return null;
332
409
  const points = toPoints(shades, groups);
333
- const assignment = points.length <= colors ? points.map((_, i) => i) : cluster(points, colors);
410
+ const assignment = points.length <= colors ? points.map((_, i) => i) : cluster(points, colors, chromaWeight);
334
411
  const sums = new Map();
335
412
  points.forEach((point, i) => {
336
- const entry = sums.get(assignment[i]) ?? { oklab: [0, 0, 0], count: 0 };
413
+ const entry = sums.get(assignment[i]) ?? { oklab: [0, 0, 0], weight: 0 };
414
+ const wt = point.count * point.salience;
337
415
  for (let c = 0; c < 3; c++)
338
- entry.oklab[c] += point.oklab[c] * point.count;
339
- entry.count += point.count;
416
+ entry.oklab[c] += point.oklab[c] * wt;
417
+ entry.weight += wt;
340
418
  sums.set(assignment[i], entry);
341
419
  });
342
420
  const palette = [];
343
- for (const { oklab, count } of sums.values()) {
344
- const [r, g, b] = oklabToRgb(oklab[0] / count, oklab[1] / count, oklab[2] / count);
345
- palette.push([r, g, b, 255]);
421
+ const paletteLabs = [];
422
+ for (const { oklab, weight } of sums.values()) {
423
+ const centerLab = [oklab[0] / weight, oklab[1] / weight, oklab[2] / weight];
424
+ const rgb = oklabToRgb(centerLab[0], centerLab[1], centerLab[2]);
425
+ palette.push([rgb[0], rgb[1], rgb[2], 255]);
426
+ paletteLabs.push(rgbToOklab(rgb[0], rgb[1], rgb[2]));
346
427
  }
347
- return palette;
428
+ // Reassign every shade directly to its closest final palette colour in chroma-weighted OKLab
429
+ // instead of locking shades to their greedy pre-merge leader group.
430
+ const shadeTargets = shades.map((shade) => nearestPaletteRgb(shade.oklab, paletteLabs, palette, chromaWeight));
431
+ return { palette, shadeTargets };
348
432
  }
349
433
  /** Flat nearest-shade remap (no positional dither). */
350
- function remapShades(image, shades, index, options) {
434
+ function remapShades(image, shades, index, options, chromaWeight) {
351
435
  const output = new Uint8ClampedArray(image.data);
352
436
  let target;
353
437
  if (options.palette) {
@@ -355,30 +439,10 @@ function remapShades(image, shades, index, options) {
355
439
  target = shades.map((shade) => nearestPaletteRgb(shade.oklab, oklabs, rgb));
356
440
  }
357
441
  else {
358
- const groups = mergeNearDuplicates(shades);
359
- const colors = options.adaptive
360
- ? Math.min(groups.length, MAX_COLORS)
361
- : Math.max(MIN_COLORS, Math.min(MAX_COLORS, Math.round(options.colors ?? DEFAULT_COLORS)));
362
- if (shades.length <= colors)
442
+ const clustered = clusterShades(shades, options, chromaWeight);
443
+ if (!clustered)
363
444
  return { width: image.width, height: image.height, data: output };
364
- const points = toPoints(shades, groups);
365
- const assignment = points.length <= colors ? points.map((_, i) => i) : cluster(points, colors);
366
- const sums = new Map();
367
- points.forEach((point, i) => {
368
- const entry = sums.get(assignment[i]) ?? { oklab: [0, 0, 0], count: 0 };
369
- for (let c = 0; c < 3; c++)
370
- entry.oklab[c] += point.oklab[c] * point.count;
371
- entry.count += point.count;
372
- sums.set(assignment[i], entry);
373
- });
374
- const colorOf = new Map();
375
- for (const [id, { oklab, count }] of sums)
376
- colorOf.set(id, oklabToRgb(oklab[0] / count, oklab[1] / count, oklab[2] / count));
377
- target = Array.from({ length: shades.length }, () => [0, 0, 0]);
378
- points.forEach((point, i) => {
379
- for (const member of point.members)
380
- target[member] = colorOf.get(assignment[i]);
381
- });
445
+ target = clustered.shadeTargets;
382
446
  }
383
447
  for (let i = 0; i < index.length; i++) {
384
448
  if (index[i] < 0)
@@ -395,11 +459,16 @@ export function snapPalette(image, options) {
395
459
  const dither = Object.values(PixelationDither).includes(options.dither)
396
460
  ? options.dither
397
461
  : PixelationDither.None;
398
- const { shades, index } = histogram(image);
399
- if (dither === PixelationDither.None)
400
- return remapShades(image, shades, index, options);
401
- // Ordered / Floyd–Steinberg need a concrete palette, then per-pixel OKLab nearest.
402
- const palette = buildPalette(shades, options);
462
+ const useSaliency = options.saliency !== false && !options.palette;
463
+ const chromaWeight = useSaliency ? SALIENCY_CHROMA_WEIGHT : 1;
464
+ const { shades, index } = histogram(image, useSaliency);
465
+ if (dither === PixelationDither.None) {
466
+ return remapShades(image, shades, index, options, chromaWeight);
467
+ }
468
+ // Ordered / Floyd–Steinberg need a concrete palette, then per-pixel nearest.
469
+ const palette = options.palette
470
+ ? paletteOklabs(options.palette).rgb
471
+ : (clusterShades(shades, options, chromaWeight)?.palette ?? null);
403
472
  if (!palette) {
404
473
  // Already within budget and no user palette: dither among the image's own shades.
405
474
  if (!shades.length)
@@ -0,0 +1,10 @@
1
+ import { type PixelBuffer } from "./base.ts";
2
+ /**
3
+ * Settle soft alpha in a converted sprite using the sampled coverage. The
4
+ * source supplies the opacity heuristic so resampling a hard-edged image keeps
5
+ * its coverage alpha. Pass one buffer to settle alpha at its current size.
6
+ * Returns a new buffer when any pixels change.
7
+ */
8
+ export declare function settlePixelAlpha(source: PixelBuffer, sampled?: PixelBuffer): PixelBuffer;
9
+ /** Settle alpha from the source pixels inside each recovered grid cell. */
10
+ export declare function settleEdgeAlpha(image: PixelBuffer, x: readonly number[], y: readonly number[], out: PixelBuffer): void;
@@ -0,0 +1,108 @@
1
+ import { UINT8_MAX } from "./base.js";
2
+ const CHANNELS = 4;
3
+ const ALPHA = 3;
4
+ const HALF_ALPHA = 128;
5
+ const TRANSLUCENT_LOW = 16;
6
+ const TRANSLUCENT_HIGH = 224;
7
+ /** Share of the visible pixels a soft outline around opaque art stays below. */
8
+ const TRANSLUCENT_SHARE = 0.2;
9
+ /** Whether the image's visible pixels are opaque but for a soft edge. */
10
+ function opaqueArt(image, requireSoftAlpha = false) {
11
+ let visible = 0;
12
+ let translucent = 0;
13
+ let solid = 0;
14
+ let fullyOpaque = 0;
15
+ for (let o = ALPHA; o < image.data.length; o += CHANNELS) {
16
+ const alpha = image.data[o];
17
+ if (!alpha)
18
+ continue;
19
+ visible++;
20
+ if (alpha > TRANSLUCENT_HIGH) {
21
+ solid++;
22
+ if (alpha === UINT8_MAX)
23
+ fullyOpaque++;
24
+ }
25
+ else if (alpha >= TRANSLUCENT_LOW)
26
+ translucent++;
27
+ }
28
+ if (visible === 0 || translucent > TRANSLUCENT_SHARE * visible)
29
+ return false;
30
+ if (!requireSoftAlpha)
31
+ return true;
32
+ // A soft sprite has a solid core and some partial alpha. Look for a change
33
+ // in coverage so an evenly translucent image keeps its original alpha.
34
+ const hasEdge = solid < visible || visible < image.width * image.height;
35
+ return hasEdge && solid > 0 && fullyOpaque < visible;
36
+ }
37
+ function hasPartialAlpha(image) {
38
+ const { data } = image;
39
+ for (let alpha = ALPHA; alpha < data.length; alpha += CHANNELS)
40
+ if (data[alpha] > 0 && data[alpha] < UINT8_MAX)
41
+ return true;
42
+ return false;
43
+ }
44
+ function writeBinaryAlpha(data, offset, covered) {
45
+ if (covered)
46
+ data[offset + ALPHA] = UINT8_MAX;
47
+ else
48
+ data.fill(0, offset, offset + CHANNELS);
49
+ }
50
+ /**
51
+ * Settle soft alpha in a converted sprite using the sampled coverage. The
52
+ * source supplies the opacity heuristic so resampling a hard-edged image keeps
53
+ * its coverage alpha. Pass one buffer to settle alpha at its current size.
54
+ * Returns a new buffer when any pixels change.
55
+ */
56
+ export function settlePixelAlpha(source, sampled = source) {
57
+ if (!hasPartialAlpha(sampled) || !opaqueArt(source, true))
58
+ return sampled;
59
+ const data = sampled.data.slice();
60
+ for (let offset = 0; offset < data.length; offset += CHANNELS) {
61
+ const alpha = data[offset + ALPHA];
62
+ if (alpha > 0 && alpha < UINT8_MAX)
63
+ writeBinaryAlpha(data, offset, alpha >= HALF_ALPHA);
64
+ }
65
+ return { ...sampled, data };
66
+ }
67
+ /** Settle alpha from the source pixels inside each recovered grid cell. */
68
+ export function settleEdgeAlpha(image, x, y, out) {
69
+ const opaque = opaqueArt(image);
70
+ for (let row = 0; row < out.height; row++)
71
+ for (let column = 0; column < out.width; column++) {
72
+ const offset = (row * out.width + column) * CHANNELS;
73
+ if (!out.data[offset + ALPHA])
74
+ continue;
75
+ const left = Math.max(0, Math.ceil(x[column])), right = Math.min(image.width, Math.ceil(x[column + 1])), top = Math.max(0, Math.ceil(y[row])), bottom = Math.min(image.height, Math.ceil(y[row + 1]));
76
+ let covered = 0, coveredAlpha = 0;
77
+ const alphas = [];
78
+ for (let py = top; py < bottom; py++)
79
+ for (let px = left; px < right; px++) {
80
+ const alpha = image.data[(py * image.width + px) * CHANNELS + ALPHA];
81
+ alphas.push(alpha);
82
+ if (alpha < HALF_ALPHA)
83
+ continue;
84
+ covered++;
85
+ coveredAlpha += alpha;
86
+ }
87
+ const area = (right - left) * (bottom - top);
88
+ if (!covered && !opaque) {
89
+ // Translucent art fills its cell evenly; a soft outline leaves most of the cell clear.
90
+ alphas.sort((a, b) => a - b);
91
+ const median = alphas[alphas.length >> 1] ?? 0;
92
+ if (median < TRANSLUCENT_LOW)
93
+ out.data.fill(0, offset, offset + CHANNELS);
94
+ else
95
+ out.data[offset + ALPHA] = median;
96
+ continue;
97
+ }
98
+ const outside = covered < area / 2;
99
+ if (opaque || outside)
100
+ writeBinaryAlpha(out.data, offset, !outside);
101
+ else {
102
+ // Translucent art (a shadow, a glow) keeps its alpha, but a covered cell above
103
+ // TRANSLUCENT_HIGH is opaque art drawn a little below 255, as everywhere else.
104
+ const alpha = covered < area ? coveredAlpha / covered : out.data[offset + ALPHA];
105
+ out.data[offset + ALPHA] = alpha > TRANSLUCENT_HIGH ? UINT8_MAX : Math.round(alpha);
106
+ }
107
+ }
108
+ }
@@ -1,15 +1,12 @@
1
1
  import type { PixelBuffer } from "./base.ts";
2
2
  import type { PixelateOptions } from "./types.ts";
3
3
  /**
4
- * Pixelate an RGBA buffer without touching the source. Nearest mode follows
5
- * nearest-neighbor `floor(dst * src / dst)` mapping. Box mode averages the
6
- * source area covered by each destination pixel. Local dominant and structural
7
- * sampling preserve contrasting regions; grid recovery restores one RGBA pixel
8
- * per detected cell. Limiting colours keeps each pixel's own alpha.
4
+ * Pixelate an RGBA buffer without touching the source.
5
+ * Uses a 4-stage strategy pipeline: Plan -> Prepass -> Sampler -> Alpha & Postprocess.
9
6
  */
10
7
  export declare function pixelateImage(image: PixelBuffer, options?: PixelateOptions): PixelBuffer;
11
8
  /**
12
- * Async pixelate for product Auto path (import-worker). Same output as pixelateImage;
13
- * Auto detect overlaps WASM AC+RL with proposers via Promise join (no COOP/COEP).
9
+ * Async counterpart of `pixelateImage`: only grid detection runs asynchronously (WASM consensus
10
+ * on a worker), then feeds the identical synchronous 4-stage pipeline.
14
11
  */
15
12
  export declare function pixelateImageAsync(image: PixelBuffer, options?: PixelateOptions): Promise<PixelBuffer>;