@workglow/tasks 0.2.20 → 0.2.21

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.
package/dist/browser.js CHANGED
@@ -218,7 +218,7 @@ function cpuBoxBlur(bin, radius) {
218
218
  return { data: dst, width, height, channels };
219
219
  }
220
220
  registerFilterOp("cpu", "blur", (image, { radius }) => {
221
- return CpuImage.fromImageBinary(cpuBoxBlur(image.getBinary(), Math.max(1, radius | 0)));
221
+ return CpuImage.fromRaw(cpuBoxBlur(image.getBinary(), Math.max(1, radius | 0)));
222
222
  });
223
223
 
224
224
  // src/task/image/border/border.cpu.ts
@@ -254,7 +254,7 @@ function cpuBorder(bin, borderWidth, color) {
254
254
  return { data: dst, width: dstW, height: dstH, channels: outCh };
255
255
  }
256
256
  registerFilterOp2("cpu", "border", (image, { borderWidth, color }) => {
257
- return CpuImage2.fromImageBinary(cpuBorder(image.getBinary(), borderWidth, color));
257
+ return CpuImage2.fromRaw(cpuBorder(image.getBinary(), borderWidth, color));
258
258
  });
259
259
 
260
260
  // src/task/image/brightness/brightness.cpu.ts
@@ -277,7 +277,7 @@ function cpuBrightness(bin, amount) {
277
277
  return { data: dst, width, height, channels };
278
278
  }
279
279
  registerFilterOp3("cpu", "brightness", (image, { amount }) => {
280
- return CpuImage3.fromImageBinary(cpuBrightness(image.getBinary(), amount));
280
+ return CpuImage3.fromRaw(cpuBrightness(image.getBinary(), amount));
281
281
  });
282
282
 
283
283
  // src/task/image/contrast/contrast.cpu.ts
@@ -305,7 +305,7 @@ function cpuContrast(bin, amount) {
305
305
  return { data: dst, width, height, channels };
306
306
  }
307
307
  registerFilterOp4("cpu", "contrast", (image, { amount }) => {
308
- return CpuImage4.fromImageBinary(cpuContrast(image.getBinary(), amount));
308
+ return CpuImage4.fromRaw(cpuContrast(image.getBinary(), amount));
309
309
  });
310
310
 
311
311
  // src/task/image/crop/crop.cpu.ts
@@ -330,7 +330,7 @@ function cpuCrop(bin, left, top, width, height) {
330
330
  return { data: dst, width: w, height: h, channels };
331
331
  }
332
332
  registerFilterOp5("cpu", "crop", (image, { left, top, width, height }) => {
333
- return CpuImage5.fromImageBinary(cpuCrop(image.getBinary(), left, top, width, height));
333
+ return CpuImage5.fromRaw(cpuCrop(image.getBinary(), left, top, width, height));
334
334
  });
335
335
 
336
336
  // src/task/image/flip/flip.cpu.ts
@@ -359,7 +359,7 @@ function cpuFlip(bin, direction) {
359
359
  return { data: dst, width, height, channels };
360
360
  }
361
361
  registerFilterOp6("cpu", "flip", (image, { direction }) => {
362
- return CpuImage6.fromImageBinary(cpuFlip(image.getBinary(), direction));
362
+ return CpuImage6.fromRaw(cpuFlip(image.getBinary(), direction));
363
363
  });
364
364
 
365
365
  // src/task/image/grayscale/grayscale.cpu.ts
@@ -386,7 +386,7 @@ function cpuGrayscale(bin) {
386
386
  return { data: dst, width, height, channels: 4 };
387
387
  }
388
388
  registerFilterOp7("cpu", "grayscale", (image, _params) => {
389
- return CpuImage7.fromImageBinary(cpuGrayscale(image.getBinary()));
389
+ return CpuImage7.fromRaw(cpuGrayscale(image.getBinary()));
390
390
  });
391
391
 
392
392
  // src/task/image/invert/invert.cpu.ts
@@ -409,7 +409,7 @@ function cpuInvert(bin) {
409
409
  return { data: dst, width, height, channels };
410
410
  }
411
411
  registerFilterOp8("cpu", "invert", (image, _params) => {
412
- return CpuImage8.fromImageBinary(cpuInvert(image.getBinary()));
412
+ return CpuImage8.fromRaw(cpuInvert(image.getBinary()));
413
413
  });
414
414
 
415
415
  // src/task/image/pixelate/pixelate.cpu.ts
@@ -445,7 +445,7 @@ function cpuPixelate(bin, blockSize) {
445
445
  return { data: dst, width, height, channels };
446
446
  }
447
447
  registerFilterOp9("cpu", "pixelate", (image, { blockSize }) => {
448
- return CpuImage9.fromImageBinary(cpuPixelate(image.getBinary(), blockSize));
448
+ return CpuImage9.fromRaw(cpuPixelate(image.getBinary(), blockSize));
449
449
  });
450
450
 
451
451
  // src/task/image/posterize/posterize.cpu.ts
@@ -473,7 +473,7 @@ function cpuPosterize(bin, levels) {
473
473
  return { data: dst, width, height, channels };
474
474
  }
475
475
  registerFilterOp10("cpu", "posterize", (image, { levels }) => {
476
- return CpuImage10.fromImageBinary(cpuPosterize(image.getBinary(), levels));
476
+ return CpuImage10.fromRaw(cpuPosterize(image.getBinary(), levels));
477
477
  });
478
478
 
479
479
  // src/task/image/resize/resize.cpu.ts
@@ -495,7 +495,7 @@ function cpuResize(bin, dstW, dstH) {
495
495
  return { data: dst, width: dstW, height: dstH, channels };
496
496
  }
497
497
  registerFilterOp11("cpu", "resize", (image, { width, height }) => {
498
- return CpuImage11.fromImageBinary(cpuResize(image.getBinary(), width, height));
498
+ return CpuImage11.fromRaw(cpuResize(image.getBinary(), width, height));
499
499
  });
500
500
 
501
501
  // src/task/image/rotate/rotate.cpu.ts
@@ -529,7 +529,7 @@ function cpuRotate(bin, angle) {
529
529
  return { data: dst, width: dstW, height: dstH, channels };
530
530
  }
531
531
  registerFilterOp12("cpu", "rotate", (image, { angle }) => {
532
- return CpuImage12.fromImageBinary(cpuRotate(image.getBinary(), angle));
532
+ return CpuImage12.fromRaw(cpuRotate(image.getBinary(), angle));
533
533
  });
534
534
 
535
535
  // src/task/image/sepia/sepia.cpu.ts
@@ -558,7 +558,7 @@ function cpuSepia(bin) {
558
558
  return { data: dst, width, height, channels };
559
559
  }
560
560
  registerFilterOp13("cpu", "sepia", (image, _params) => {
561
- return CpuImage13.fromImageBinary(cpuSepia(image.getBinary()));
561
+ return CpuImage13.fromRaw(cpuSepia(image.getBinary()));
562
562
  });
563
563
 
564
564
  // src/task/image/threshold/threshold.cpu.ts
@@ -583,7 +583,7 @@ function cpuThreshold(bin, value) {
583
583
  return { data: dst, width, height, channels };
584
584
  }
585
585
  registerFilterOp14("cpu", "threshold", (image, { value }) => {
586
- return CpuImage14.fromImageBinary(cpuThreshold(image.getBinary(), value));
586
+ return CpuImage14.fromRaw(cpuThreshold(image.getBinary(), value));
587
587
  });
588
588
 
589
589
  // src/task/image/tint/tint.cpu.ts
@@ -623,7 +623,7 @@ function cpuTint(bin, tr, tg, tb, amount) {
623
623
  }
624
624
  registerFilterOp15("cpu", "tint", (image, { color, amount }) => {
625
625
  const { r: tr, g: tg, b: tb } = resolveColor2(color);
626
- return CpuImage15.fromImageBinary(cpuTint(image.getBinary(), tr, tg, tb, amount));
626
+ return CpuImage15.fromRaw(cpuTint(image.getBinary(), tr, tg, tb, amount));
627
627
  });
628
628
 
629
629
  // src/task/image/transparency/transparency.cpu.ts
@@ -645,7 +645,7 @@ function cpuTransparency(bin, amount) {
645
645
  return { data: dst, width, height, channels: 4 };
646
646
  }
647
647
  registerFilterOp16("cpu", "transparency", (image, { amount }) => {
648
- return CpuImage16.fromImageBinary(cpuTransparency(image.getBinary(), amount));
648
+ return CpuImage16.fromRaw(cpuTransparency(image.getBinary(), amount));
649
649
  });
650
650
 
651
651
  // src/task/image/blur/blur.webgpu.ts
@@ -687,7 +687,7 @@ registerFilterOp17("webgpu", "blur", (image, { radius }) => {
687
687
  uniforms: makeUniforms(radius, 0, w, h)
688
688
  });
689
689
  const vert = horiz.apply({ shader: SHADER_SRC, uniforms: makeUniforms(radius, 1, w, h) });
690
- horiz.release();
690
+ horiz.dispose();
691
691
  return vert;
692
692
  });
693
693
 
@@ -1057,8 +1057,22 @@ registerFilterOp32("webgpu", "transparency", (image, { amount }) => {
1057
1057
  });
1058
1058
 
1059
1059
  // src/codec.browser.ts
1060
- import { applyFilter, registerPreviewResizeFn } from "@workglow/util/media";
1061
- registerPreviewResizeFn((image, width, height) => applyFilter(image, "resize", { width, height }));
1060
+ import {
1061
+ GpuImageFactory,
1062
+ applyFilter,
1063
+ registerPreviewResizeFn
1064
+ } from "@workglow/util/media";
1065
+ registerPreviewResizeFn(async (value, width, height) => {
1066
+ const gpu = await GpuImageFactory.from(value);
1067
+ try {
1068
+ const out = applyFilter(gpu, "resize", { width, height });
1069
+ gpu.dispose();
1070
+ return await out.toImageValue(value.previewScale);
1071
+ } catch (err) {
1072
+ gpu.dispose();
1073
+ throw err;
1074
+ }
1075
+ });
1062
1076
 
1063
1077
  // src/task/image/imageTextRender.ts
1064
1078
  import { createServiceToken, globalServiceRegistry } from "@workglow/util";
@@ -6656,88 +6670,53 @@ import {
6656
6670
  } from "@workglow/util/media";
6657
6671
 
6658
6672
  // src/task/image/ImageFilterTask.ts
6659
- import {
6660
- Task as Task42
6661
- } from "@workglow/task-graph";
6662
- import {
6663
- applyFilter as applyFilter2,
6664
- CpuImage as CpuImage17,
6665
- GpuImageFactory,
6666
- getGpuImageFactory,
6667
- hasFilterOp,
6668
- previewSource
6669
- } from "@workglow/util/media";
6673
+ import { Task as Task42 } from "@workglow/task-graph";
6674
+ import { applyFilter as applyFilter2, CpuImage as CpuImage17, GpuImageFactory as GpuImageFactory2, hasFilterOp } from "@workglow/util/media";
6670
6675
 
6671
6676
  class ImageFilterTask extends Task42 {
6672
6677
  scalePreviewParams(params, _scale) {
6673
6678
  return params;
6674
6679
  }
6675
- async hydrateInput(image) {
6676
- if (image !== null && typeof image === "object" && "backend" in image && "retain" in image && "release" in image && "materialize" in image) {
6677
- return image;
6678
- }
6679
- if (typeof image === "string" && image.startsWith("data:")) {
6680
- return GpuImageFactory.fromDataUri(image);
6681
- }
6682
- if (typeof Blob !== "undefined" && image instanceof Blob) {
6683
- return GpuImageFactory.fromBlob(image);
6684
- }
6685
- if (typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) {
6686
- const fromImageBitmap = getGpuImageFactory("fromImageBitmap");
6687
- if (!fromImageBitmap) {
6688
- throw new Error("ImageFilterTask: received ImageBitmap but GpuImage.fromImageBitmap is not registered " + "in this runtime. ImageBitmap inputs require the browser entry point.");
6680
+ async runFilter(input) {
6681
+ const previewScale = input.image.previewScale;
6682
+ let gpu = await GpuImageFactory2.from(input.image);
6683
+ try {
6684
+ if (!hasFilterOp(gpu.backend, this.filterName)) {
6685
+ const cpu = await CpuImage17.from(input.image);
6686
+ gpu.dispose();
6687
+ gpu = cpu;
6688
+ }
6689
+ const params = this.scalePreviewParams(this.opParams(input), previewScale);
6690
+ const out = applyFilter2(gpu, this.filterName, params);
6691
+ gpu.dispose();
6692
+ try {
6693
+ const value = await out.toImageValue(previewScale);
6694
+ return { image: value };
6695
+ } catch (err) {
6696
+ try {
6697
+ out.dispose();
6698
+ } catch {}
6699
+ throw err;
6689
6700
  }
6690
- return fromImageBitmap(image);
6691
- }
6692
- if (image !== null && typeof image === "object" && "data" in image && "width" in image && "height" in image && "channels" in image) {
6693
- const bin = image;
6694
- const asyncFactory = getGpuImageFactory("fromImageBinaryAsync");
6695
- if (asyncFactory)
6696
- return asyncFactory(bin);
6697
- return GpuImageFactory.fromImageBinary(bin);
6701
+ } catch (err) {
6702
+ gpu.dispose();
6703
+ throw err;
6698
6704
  }
6699
- const ctor = image && typeof image === "object" && image.constructor ? image.constructor.name : typeof image;
6700
- const keys = image && typeof image === "object" ? Object.keys(image).slice(0, 10).join(", ") : "";
6701
- throw new Error(`ImageFilterTask: input.image is not a recognized image shape (got ${ctor}` + (keys ? ` with keys [${keys}]` : "") + `). Expected one of: GpuImage instance, raw ImageBinary, Blob, ImageBitmap, ` + `or a data: URI string.`);
6702
6705
  }
6703
- async execute(input, ctx) {
6704
- let inputImage = await this.hydrateInput(input.image);
6705
- if (!hasFilterOp(inputImage.backend, this.filterName)) {
6706
- const bin = await inputImage.materialize();
6707
- const cpu = CpuImage17.fromImageBinary(bin, inputImage.previewScale);
6708
- inputImage.release();
6709
- inputImage = cpu;
6710
- }
6711
- const params = this.scalePreviewParams(this.opParams(input), inputImage.previewScale);
6712
- const out = applyFilter2(inputImage, this.filterName, params);
6713
- inputImage.release();
6714
- ctx.resourceScope?.register(`gpuimage:${String(this.id)}:image`, async () => out.release());
6715
- return { image: out };
6706
+ async execute(input, _ctx) {
6707
+ return this.runFilter(input);
6716
6708
  }
6717
6709
  async executePreview(input, _ctx) {
6718
- const inputImage = await this.hydrateInput(input.image);
6719
- let sourced = previewSource(inputImage);
6720
- if (!hasFilterOp(sourced.backend, this.filterName)) {
6721
- const bin = await sourced.materialize();
6722
- const cpu = CpuImage17.fromImageBinary(bin, sourced.previewScale);
6723
- if (sourced !== inputImage)
6724
- sourced.release();
6725
- sourced = cpu;
6726
- }
6727
- const params = this.scalePreviewParams(this.opParams(input), sourced.previewScale);
6728
- const out = applyFilter2(sourced, this.filterName, params);
6729
- if (sourced !== inputImage)
6730
- sourced.release();
6731
- return { image: out };
6710
+ return this.runFilter(input);
6732
6711
  }
6733
6712
  }
6734
6713
  // src/task/image/blur/ImageBlurTask.ts
6735
6714
  import { CreateWorkflow as CreateWorkflow16, Workflow as Workflow17 } from "@workglow/task-graph";
6736
- import { GpuImageSchema } from "@workglow/util/media";
6715
+ import { ImageValueSchema } from "@workglow/util/media";
6737
6716
  var inputSchema41 = {
6738
6717
  type: "object",
6739
6718
  properties: {
6740
- image: GpuImageSchema({ title: "Image", description: "Source image" }),
6719
+ image: ImageValueSchema({ title: "Image", description: "Source image" }),
6741
6720
  radius: {
6742
6721
  type: "number",
6743
6722
  title: "Radius",
@@ -6752,7 +6731,7 @@ var inputSchema41 = {
6752
6731
  };
6753
6732
  var outputSchema40 = {
6754
6733
  type: "object",
6755
- properties: { image: GpuImageSchema({ title: "Image", description: "Blurred image" }) },
6734
+ properties: { image: ImageValueSchema({ title: "Image", description: "Blurred image" }) },
6756
6735
  required: ["image"],
6757
6736
  additionalProperties: false
6758
6737
  };
@@ -6779,11 +6758,11 @@ class ImageBlurTask extends ImageFilterTask {
6779
6758
  Workflow17.prototype.imageBlur = CreateWorkflow16(ImageBlurTask);
6780
6759
  // src/task/image/border/ImageBorderTask.ts
6781
6760
  import { CreateWorkflow as CreateWorkflow17, Workflow as Workflow18 } from "@workglow/task-graph";
6782
- import { GpuImageSchema as GpuImageSchema2 } from "@workglow/util/media";
6761
+ import { ImageValueSchema as ImageValueSchema2 } from "@workglow/util/media";
6783
6762
  var inputSchema42 = {
6784
6763
  type: "object",
6785
6764
  properties: {
6786
- image: GpuImageSchema2({ title: "Image", description: "Source image" }),
6765
+ image: ImageValueSchema2({ title: "Image", description: "Source image" }),
6787
6766
  borderWidth: {
6788
6767
  type: "integer",
6789
6768
  title: "Border Width",
@@ -6816,7 +6795,7 @@ var inputSchema42 = {
6816
6795
  };
6817
6796
  var outputSchema41 = {
6818
6797
  type: "object",
6819
- properties: { image: GpuImageSchema2({ title: "Image", description: "Image with border" }) },
6798
+ properties: { image: ImageValueSchema2({ title: "Image", description: "Image with border" }) },
6820
6799
  required: ["image"],
6821
6800
  additionalProperties: false
6822
6801
  };
@@ -6846,11 +6825,11 @@ class ImageBorderTask extends ImageFilterTask {
6846
6825
  Workflow18.prototype.imageBorder = CreateWorkflow17(ImageBorderTask);
6847
6826
  // src/task/image/brightness/ImageBrightnessTask.ts
6848
6827
  import { CreateWorkflow as CreateWorkflow18, Workflow as Workflow19 } from "@workglow/task-graph";
6849
- import { GpuImageSchema as GpuImageSchema3 } from "@workglow/util/media";
6828
+ import { ImageValueSchema as ImageValueSchema3 } from "@workglow/util/media";
6850
6829
  var inputSchema43 = {
6851
6830
  type: "object",
6852
6831
  properties: {
6853
- image: GpuImageSchema3({ title: "Image", description: "Source image" }),
6832
+ image: ImageValueSchema3({ title: "Image", description: "Source image" }),
6854
6833
  amount: {
6855
6834
  type: "number",
6856
6835
  title: "Amount",
@@ -6865,7 +6844,7 @@ var inputSchema43 = {
6865
6844
  };
6866
6845
  var outputSchema42 = {
6867
6846
  type: "object",
6868
- properties: { image: GpuImageSchema3({ title: "Image", description: "Brightness-adjusted image" }) },
6847
+ properties: { image: ImageValueSchema3({ title: "Image", description: "Brightness-adjusted image" }) },
6869
6848
  required: ["image"],
6870
6849
  additionalProperties: false
6871
6850
  };
@@ -6889,11 +6868,11 @@ class ImageBrightnessTask extends ImageFilterTask {
6889
6868
  Workflow19.prototype.imageBrightness = CreateWorkflow18(ImageBrightnessTask);
6890
6869
  // src/task/image/contrast/ImageContrastTask.ts
6891
6870
  import { CreateWorkflow as CreateWorkflow19, Workflow as Workflow20 } from "@workglow/task-graph";
6892
- import { GpuImageSchema as GpuImageSchema4 } from "@workglow/util/media";
6871
+ import { ImageValueSchema as ImageValueSchema4 } from "@workglow/util/media";
6893
6872
  var inputSchema44 = {
6894
6873
  type: "object",
6895
6874
  properties: {
6896
- image: GpuImageSchema4({ title: "Image", description: "Source image" }),
6875
+ image: ImageValueSchema4({ title: "Image", description: "Source image" }),
6897
6876
  amount: {
6898
6877
  type: "number",
6899
6878
  title: "Amount",
@@ -6908,7 +6887,7 @@ var inputSchema44 = {
6908
6887
  };
6909
6888
  var outputSchema43 = {
6910
6889
  type: "object",
6911
- properties: { image: GpuImageSchema4({ title: "Image", description: "Contrast-adjusted image" }) },
6890
+ properties: { image: ImageValueSchema4({ title: "Image", description: "Contrast-adjusted image" }) },
6912
6891
  required: ["image"],
6913
6892
  additionalProperties: false
6914
6893
  };
@@ -6932,11 +6911,11 @@ class ImageContrastTask extends ImageFilterTask {
6932
6911
  Workflow20.prototype.imageContrast = CreateWorkflow19(ImageContrastTask);
6933
6912
  // src/task/image/crop/ImageCropTask.ts
6934
6913
  import { CreateWorkflow as CreateWorkflow20, Workflow as Workflow21 } from "@workglow/task-graph";
6935
- import { GpuImageSchema as GpuImageSchema5 } from "@workglow/util/media";
6914
+ import { ImageValueSchema as ImageValueSchema5 } from "@workglow/util/media";
6936
6915
  var inputSchema45 = {
6937
6916
  type: "object",
6938
6917
  properties: {
6939
- image: GpuImageSchema5({ title: "Image", description: "Source image" }),
6918
+ image: ImageValueSchema5({ title: "Image", description: "Source image" }),
6940
6919
  left: { type: "integer", title: "Left", description: "Left offset", minimum: 0, default: 0 },
6941
6920
  top: { type: "integer", title: "Top", description: "Top offset", minimum: 0, default: 0 },
6942
6921
  width: { type: "integer", title: "Width", description: "Crop width", minimum: 1 },
@@ -6947,7 +6926,7 @@ var inputSchema45 = {
6947
6926
  };
6948
6927
  var outputSchema44 = {
6949
6928
  type: "object",
6950
- properties: { image: GpuImageSchema5({ title: "Image", description: "Cropped image" }) },
6929
+ properties: { image: ImageValueSchema5({ title: "Image", description: "Cropped image" }) },
6951
6930
  required: ["image"],
6952
6931
  additionalProperties: false
6953
6932
  };
@@ -6984,11 +6963,11 @@ class ImageCropTask extends ImageFilterTask {
6984
6963
  Workflow21.prototype.imageCrop = CreateWorkflow20(ImageCropTask);
6985
6964
  // src/task/image/flip/ImageFlipTask.ts
6986
6965
  import { CreateWorkflow as CreateWorkflow21, Workflow as Workflow22 } from "@workglow/task-graph";
6987
- import { GpuImageSchema as GpuImageSchema6 } from "@workglow/util/media";
6966
+ import { ImageValueSchema as ImageValueSchema6 } from "@workglow/util/media";
6988
6967
  var inputSchema46 = {
6989
6968
  type: "object",
6990
6969
  properties: {
6991
- image: GpuImageSchema6({ title: "Image", description: "Source image" }),
6970
+ image: ImageValueSchema6({ title: "Image", description: "Source image" }),
6992
6971
  direction: {
6993
6972
  type: "string",
6994
6973
  enum: ["horizontal", "vertical"],
@@ -7002,7 +6981,7 @@ var inputSchema46 = {
7002
6981
  };
7003
6982
  var outputSchema45 = {
7004
6983
  type: "object",
7005
- properties: { image: GpuImageSchema6({ title: "Image", description: "Flipped image" }) },
6984
+ properties: { image: ImageValueSchema6({ title: "Image", description: "Flipped image" }) },
7006
6985
  required: ["image"],
7007
6986
  additionalProperties: false
7008
6987
  };
@@ -7026,16 +7005,16 @@ class ImageFlipTask extends ImageFilterTask {
7026
7005
  Workflow22.prototype.imageFlip = CreateWorkflow21(ImageFlipTask);
7027
7006
  // src/task/image/grayscale/ImageGrayscaleTask.ts
7028
7007
  import { CreateWorkflow as CreateWorkflow22, Workflow as Workflow23 } from "@workglow/task-graph";
7029
- import { GpuImageSchema as GpuImageSchema7 } from "@workglow/util/media";
7008
+ import { ImageValueSchema as ImageValueSchema7 } from "@workglow/util/media";
7030
7009
  var inputSchema47 = {
7031
7010
  type: "object",
7032
- properties: { image: GpuImageSchema7({ title: "Image", description: "Source image" }) },
7011
+ properties: { image: ImageValueSchema7({ title: "Image", description: "Source image" }) },
7033
7012
  required: ["image"],
7034
7013
  additionalProperties: false
7035
7014
  };
7036
7015
  var outputSchema46 = {
7037
7016
  type: "object",
7038
- properties: { image: GpuImageSchema7({ title: "Image", description: "Grayscale image" }) },
7017
+ properties: { image: ImageValueSchema7({ title: "Image", description: "Grayscale image" }) },
7039
7018
  required: ["image"],
7040
7019
  additionalProperties: false
7041
7020
  };
@@ -7059,16 +7038,16 @@ class ImageGrayscaleTask extends ImageFilterTask {
7059
7038
  Workflow23.prototype.imageGrayscale = CreateWorkflow22(ImageGrayscaleTask);
7060
7039
  // src/task/image/invert/ImageInvertTask.ts
7061
7040
  import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow24 } from "@workglow/task-graph";
7062
- import { GpuImageSchema as GpuImageSchema8 } from "@workglow/util/media";
7041
+ import { ImageValueSchema as ImageValueSchema8 } from "@workglow/util/media";
7063
7042
  var inputSchema48 = {
7064
7043
  type: "object",
7065
- properties: { image: GpuImageSchema8({ title: "Image", description: "Source image" }) },
7044
+ properties: { image: ImageValueSchema8({ title: "Image", description: "Source image" }) },
7066
7045
  required: ["image"],
7067
7046
  additionalProperties: false
7068
7047
  };
7069
7048
  var outputSchema47 = {
7070
7049
  type: "object",
7071
- properties: { image: GpuImageSchema8({ title: "Image", description: "Inverted image" }) },
7050
+ properties: { image: ImageValueSchema8({ title: "Image", description: "Inverted image" }) },
7072
7051
  required: ["image"],
7073
7052
  additionalProperties: false
7074
7053
  };
@@ -7092,11 +7071,11 @@ class ImageInvertTask extends ImageFilterTask {
7092
7071
  Workflow24.prototype.imageInvert = CreateWorkflow23(ImageInvertTask);
7093
7072
  // src/task/image/pixelate/ImagePixelateTask.ts
7094
7073
  import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow25 } from "@workglow/task-graph";
7095
- import { GpuImageSchema as GpuImageSchema9 } from "@workglow/util/media";
7074
+ import { ImageValueSchema as ImageValueSchema9 } from "@workglow/util/media";
7096
7075
  var inputSchema49 = {
7097
7076
  type: "object",
7098
7077
  properties: {
7099
- image: GpuImageSchema9({ title: "Image", description: "Source image" }),
7078
+ image: ImageValueSchema9({ title: "Image", description: "Source image" }),
7100
7079
  blockSize: {
7101
7080
  type: "integer",
7102
7081
  title: "Block Size",
@@ -7111,7 +7090,7 @@ var inputSchema49 = {
7111
7090
  };
7112
7091
  var outputSchema48 = {
7113
7092
  type: "object",
7114
- properties: { image: GpuImageSchema9({ title: "Image", description: "Pixelated image" }) },
7093
+ properties: { image: ImageValueSchema9({ title: "Image", description: "Pixelated image" }) },
7115
7094
  required: ["image"],
7116
7095
  additionalProperties: false
7117
7096
  };
@@ -7138,11 +7117,11 @@ class ImagePixelateTask extends ImageFilterTask {
7138
7117
  Workflow25.prototype.imagePixelate = CreateWorkflow24(ImagePixelateTask);
7139
7118
  // src/task/image/posterize/ImagePosterizeTask.ts
7140
7119
  import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow26 } from "@workglow/task-graph";
7141
- import { GpuImageSchema as GpuImageSchema10 } from "@workglow/util/media";
7120
+ import { ImageValueSchema as ImageValueSchema10 } from "@workglow/util/media";
7142
7121
  var inputSchema50 = {
7143
7122
  type: "object",
7144
7123
  properties: {
7145
- image: GpuImageSchema10({ title: "Image", description: "Source image" }),
7124
+ image: ImageValueSchema10({ title: "Image", description: "Source image" }),
7146
7125
  levels: {
7147
7126
  type: "integer",
7148
7127
  title: "Levels",
@@ -7157,7 +7136,7 @@ var inputSchema50 = {
7157
7136
  };
7158
7137
  var outputSchema49 = {
7159
7138
  type: "object",
7160
- properties: { image: GpuImageSchema10({ title: "Image", description: "Posterized image" }) },
7139
+ properties: { image: ImageValueSchema10({ title: "Image", description: "Posterized image" }) },
7161
7140
  required: ["image"],
7162
7141
  additionalProperties: false
7163
7142
  };
@@ -7183,11 +7162,11 @@ Workflow26.prototype.imagePosterize = CreateWorkflow25(ImagePosterizeTask);
7183
7162
  import { getImageRasterCodec, registerImageRasterCodec as registerImageRasterCodec2 } from "@workglow/util/media";
7184
7163
  // src/task/image/resize/ImageResizeTask.ts
7185
7164
  import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow27 } from "@workglow/task-graph";
7186
- import { GpuImageSchema as GpuImageSchema11 } from "@workglow/util/media";
7165
+ import { ImageValueSchema as ImageValueSchema11 } from "@workglow/util/media";
7187
7166
  var inputSchema51 = {
7188
7167
  type: "object",
7189
7168
  properties: {
7190
- image: GpuImageSchema11({ title: "Image", description: "Source image" }),
7169
+ image: ImageValueSchema11({ title: "Image", description: "Source image" }),
7191
7170
  width: { type: "integer", title: "Width", description: "Target width in pixels", minimum: 1 },
7192
7171
  height: { type: "integer", title: "Height", description: "Target height in pixels", minimum: 1 },
7193
7172
  fit: {
@@ -7208,7 +7187,7 @@ var inputSchema51 = {
7208
7187
  };
7209
7188
  var outputSchema50 = {
7210
7189
  type: "object",
7211
- properties: { image: GpuImageSchema11({ title: "Image", description: "Resized image" }) },
7190
+ properties: { image: ImageValueSchema11({ title: "Image", description: "Resized image" }) },
7212
7191
  required: ["image"],
7213
7192
  additionalProperties: false
7214
7193
  };
@@ -7245,11 +7224,11 @@ class ImageResizeTask extends ImageFilterTask {
7245
7224
  Workflow27.prototype.imageResize = CreateWorkflow26(ImageResizeTask);
7246
7225
  // src/task/image/rotate/ImageRotateTask.ts
7247
7226
  import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow28 } from "@workglow/task-graph";
7248
- import { GpuImageSchema as GpuImageSchema12 } from "@workglow/util/media";
7227
+ import { ImageValueSchema as ImageValueSchema12 } from "@workglow/util/media";
7249
7228
  var inputSchema52 = {
7250
7229
  type: "object",
7251
7230
  properties: {
7252
- image: GpuImageSchema12({ title: "Image", description: "Source image" }),
7231
+ image: ImageValueSchema12({ title: "Image", description: "Source image" }),
7253
7232
  angle: {
7254
7233
  type: "integer",
7255
7234
  enum: [90, 180, 270],
@@ -7267,7 +7246,7 @@ var inputSchema52 = {
7267
7246
  };
7268
7247
  var outputSchema51 = {
7269
7248
  type: "object",
7270
- properties: { image: GpuImageSchema12({ title: "Image", description: "Rotated image" }) },
7249
+ properties: { image: ImageValueSchema12({ title: "Image", description: "Rotated image" }) },
7271
7250
  required: ["image"],
7272
7251
  additionalProperties: false
7273
7252
  };
@@ -7349,16 +7328,16 @@ var ColorFromSchemaOptions = {
7349
7328
  };
7350
7329
  // src/task/image/sepia/ImageSepiaTask.ts
7351
7330
  import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow29 } from "@workglow/task-graph";
7352
- import { GpuImageSchema as GpuImageSchema13 } from "@workglow/util/media";
7331
+ import { ImageValueSchema as ImageValueSchema13 } from "@workglow/util/media";
7353
7332
  var inputSchema53 = {
7354
7333
  type: "object",
7355
- properties: { image: GpuImageSchema13({ title: "Image", description: "Source image" }) },
7334
+ properties: { image: ImageValueSchema13({ title: "Image", description: "Source image" }) },
7356
7335
  required: ["image"],
7357
7336
  additionalProperties: false
7358
7337
  };
7359
7338
  var outputSchema52 = {
7360
7339
  type: "object",
7361
- properties: { image: GpuImageSchema13({ title: "Image", description: "Sepia-toned image" }) },
7340
+ properties: { image: ImageValueSchema13({ title: "Image", description: "Sepia-toned image" }) },
7362
7341
  required: ["image"],
7363
7342
  additionalProperties: false
7364
7343
  };
@@ -7389,7 +7368,7 @@ import {
7389
7368
  import {
7390
7369
  CpuImage as CpuImage18,
7391
7370
  getPreviewBudget,
7392
- GpuImageSchema as GpuImageSchema14,
7371
+ ImageValueSchema as ImageValueSchema14,
7393
7372
  resolveColor as resolveColor5
7394
7373
  } from "@workglow/util/media";
7395
7374
  function toRgbaImage(image) {
@@ -7466,7 +7445,7 @@ var IMAGE_TEXT_POSITION_LABELS = {
7466
7445
  "bottom-center": "Bottom center",
7467
7446
  "bottom-right": "Bottom right"
7468
7447
  };
7469
- var backgroundImageProperty = GpuImageSchema14({
7448
+ var backgroundImageProperty = ImageValueSchema14({
7470
7449
  title: "Image",
7471
7450
  description: "Background image to render the text onto"
7472
7451
  });
@@ -7531,7 +7510,7 @@ var inputSchema54 = {
7531
7510
  var outputSchema53 = {
7532
7511
  type: "object",
7533
7512
  properties: {
7534
- image: GpuImageSchema14({ title: "Image", description: "Raster image with text" })
7513
+ image: ImageValueSchema14({ title: "Image", description: "Raster image with text" })
7535
7514
  },
7536
7515
  required: ["image"],
7537
7516
  additionalProperties: false
@@ -7554,7 +7533,8 @@ function requireStandaloneDims(input) {
7554
7533
  return { width: input.width, height: input.height };
7555
7534
  }
7556
7535
  async function renderTextOverBackground(params, backgroundImage, previewScale) {
7557
- const background = await backgroundImage.materialize();
7536
+ const cpu = await CpuImage18.from(backgroundImage);
7537
+ const background = cpu.getBinary();
7558
7538
  const overlay = await renderImageTextToRgba({
7559
7539
  text: params.text,
7560
7540
  font: params.font,
@@ -7568,7 +7548,7 @@ async function renderTextOverBackground(params, backgroundImage, previewScale) {
7568
7548
  });
7569
7549
  const composited = compositeTextOverBackground(background, overlay);
7570
7550
  return {
7571
- image: CpuImage18.fromImageBinary(composited, previewScale)
7551
+ image: await CpuImage18.fromRaw(composited).toImageValue(previewScale)
7572
7552
  };
7573
7553
  }
7574
7554
  async function renderTextStandalone(params, width, height, previewScale) {
@@ -7584,7 +7564,7 @@ async function renderTextStandalone(params, width, height, previewScale) {
7584
7564
  position: params.position
7585
7565
  });
7586
7566
  return {
7587
- image: CpuImage18.fromImageBinary(textBinary, previewScale)
7567
+ image: await CpuImage18.fromRaw(textBinary).toImageValue(previewScale)
7588
7568
  };
7589
7569
  }
7590
7570
  async function runText(input) {
@@ -7634,11 +7614,11 @@ class ImageTextTask extends Task43 {
7634
7614
  Workflow30.prototype.imageText = CreateWorkflow29(ImageTextTask);
7635
7615
  // src/task/image/threshold/ImageThresholdTask.ts
7636
7616
  import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow31 } from "@workglow/task-graph";
7637
- import { GpuImageSchema as GpuImageSchema15 } from "@workglow/util/media";
7617
+ import { ImageValueSchema as ImageValueSchema15 } from "@workglow/util/media";
7638
7618
  var inputSchema55 = {
7639
7619
  type: "object",
7640
7620
  properties: {
7641
- image: GpuImageSchema15({ title: "Image", description: "Source image" }),
7621
+ image: ImageValueSchema15({ title: "Image", description: "Source image" }),
7642
7622
  value: {
7643
7623
  type: "number",
7644
7624
  title: "Value",
@@ -7653,7 +7633,7 @@ var inputSchema55 = {
7653
7633
  };
7654
7634
  var outputSchema54 = {
7655
7635
  type: "object",
7656
- properties: { image: GpuImageSchema15({ title: "Image", description: "Thresholded image" }) },
7636
+ properties: { image: ImageValueSchema15({ title: "Image", description: "Thresholded image" }) },
7657
7637
  required: ["image"],
7658
7638
  additionalProperties: false
7659
7639
  };
@@ -7677,11 +7657,11 @@ class ImageThresholdTask extends ImageFilterTask {
7677
7657
  Workflow31.prototype.imageThreshold = CreateWorkflow30(ImageThresholdTask);
7678
7658
  // src/task/image/tint/ImageTintTask.ts
7679
7659
  import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow32 } from "@workglow/task-graph";
7680
- import { GpuImageSchema as GpuImageSchema16 } from "@workglow/util/media";
7660
+ import { ImageValueSchema as ImageValueSchema16 } from "@workglow/util/media";
7681
7661
  var inputSchema56 = {
7682
7662
  type: "object",
7683
7663
  properties: {
7684
- image: GpuImageSchema16({ title: "Image", description: "Source image" }),
7664
+ image: ImageValueSchema16({ title: "Image", description: "Source image" }),
7685
7665
  color: ColorValueSchema({ title: "Color", description: "Tint color" }),
7686
7666
  amount: {
7687
7667
  type: "number",
@@ -7697,7 +7677,7 @@ var inputSchema56 = {
7697
7677
  };
7698
7678
  var outputSchema55 = {
7699
7679
  type: "object",
7700
- properties: { image: GpuImageSchema16({ title: "Image", description: "Tinted image" }) },
7680
+ properties: { image: ImageValueSchema16({ title: "Image", description: "Tinted image" }) },
7701
7681
  required: ["image"],
7702
7682
  additionalProperties: false
7703
7683
  };
@@ -7724,11 +7704,11 @@ class ImageTintTask extends ImageFilterTask {
7724
7704
  Workflow32.prototype.imageTint = CreateWorkflow31(ImageTintTask);
7725
7705
  // src/task/image/transparency/ImageTransparencyTask.ts
7726
7706
  import { CreateWorkflow as CreateWorkflow32, Workflow as Workflow33 } from "@workglow/task-graph";
7727
- import { GpuImageSchema as GpuImageSchema17 } from "@workglow/util/media";
7707
+ import { ImageValueSchema as ImageValueSchema17 } from "@workglow/util/media";
7728
7708
  var inputSchema57 = {
7729
7709
  type: "object",
7730
7710
  properties: {
7731
- image: GpuImageSchema17({ title: "Image", description: "Source image" }),
7711
+ image: ImageValueSchema17({ title: "Image", description: "Source image" }),
7732
7712
  amount: {
7733
7713
  type: "number",
7734
7714
  title: "Amount",
@@ -7743,7 +7723,7 @@ var inputSchema57 = {
7743
7723
  };
7744
7724
  var outputSchema56 = {
7745
7725
  type: "object",
7746
- properties: { image: GpuImageSchema17({ title: "Image", description: "Image with adjusted transparency" }) },
7726
+ properties: { image: ImageValueSchema17({ title: "Image", description: "Image with adjusted transparency" }) },
7747
7727
  required: ["image"],
7748
7728
  additionalProperties: false
7749
7729
  };
@@ -16067,4 +16047,4 @@ export {
16067
16047
  ArrayTask
16068
16048
  };
16069
16049
 
16070
- //# debugId=D3AD9302546FF7B664756E2164756E21
16050
+ //# debugId=BBFCBB7DB79C30E864756E2164756E21