@workglow/tasks 0.2.0 → 0.2.1
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.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1265 -11
- package/dist/browser.js.map +22 -4
- package/dist/bun.d.ts +1 -1
- package/dist/bun.d.ts.map +1 -1
- package/dist/bun.js +1268 -14
- package/dist/bun.js.map +22 -4
- package/dist/common.d.ts +36 -1
- package/dist/common.d.ts.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +1268 -14
- package/dist/node.js.map +22 -4
- package/dist/task/image/ImageBlurTask.d.ts +219 -0
- package/dist/task/image/ImageBlurTask.d.ts.map +1 -0
- package/dist/task/image/ImageBorderTask.d.ts +281 -0
- package/dist/task/image/ImageBorderTask.d.ts.map +1 -0
- package/dist/task/image/ImageBrightnessTask.d.ts +219 -0
- package/dist/task/image/ImageBrightnessTask.d.ts.map +1 -0
- package/dist/task/image/ImageContrastTask.d.ts +219 -0
- package/dist/task/image/ImageContrastTask.d.ts.map +1 -0
- package/dist/task/image/ImageCropTask.d.ts +251 -0
- package/dist/task/image/ImageCropTask.d.ts.map +1 -0
- package/dist/task/image/ImageFlipTask.d.ts +215 -0
- package/dist/task/image/ImageFlipTask.d.ts.map +1 -0
- package/dist/task/image/ImageGrayscaleTask.d.ts +203 -0
- package/dist/task/image/ImageGrayscaleTask.d.ts.map +1 -0
- package/dist/task/image/ImageInvertTask.d.ts +203 -0
- package/dist/task/image/ImageInvertTask.d.ts.map +1 -0
- package/dist/task/image/ImagePixelateTask.d.ts +217 -0
- package/dist/task/image/ImagePixelateTask.d.ts.map +1 -0
- package/dist/task/image/ImagePosterizeTask.d.ts +219 -0
- package/dist/task/image/ImagePosterizeTask.d.ts.map +1 -0
- package/dist/task/image/ImageResizeTask.d.ts +227 -0
- package/dist/task/image/ImageResizeTask.d.ts.map +1 -0
- package/dist/task/image/ImageRotateTask.d.ts +215 -0
- package/dist/task/image/ImageRotateTask.d.ts.map +1 -0
- package/dist/task/image/ImageSchemas.d.ts +94 -0
- package/dist/task/image/ImageSchemas.d.ts.map +1 -0
- package/dist/task/image/ImageSepiaTask.d.ts +203 -0
- package/dist/task/image/ImageSepiaTask.d.ts.map +1 -0
- package/dist/task/image/ImageThresholdTask.d.ts +219 -0
- package/dist/task/image/ImageThresholdTask.d.ts.map +1 -0
- package/dist/task/image/ImageTintTask.d.ts +283 -0
- package/dist/task/image/ImageTintTask.d.ts.map +1 -0
- package/dist/task/image/ImageTransparencyTask.d.ts +217 -0
- package/dist/task/image/ImageTransparencyTask.d.ts.map +1 -0
- package/dist/task/image/ImageWatermarkTask.d.ts +247 -0
- package/dist/task/image/ImageWatermarkTask.d.ts.map +1 -0
- package/package.json +9 -9
package/dist/node.js
CHANGED
|
@@ -9940,6 +9940,1223 @@ class VectorScaleTask extends Task50 {
|
|
|
9940
9940
|
}
|
|
9941
9941
|
}
|
|
9942
9942
|
Workflow52.prototype.vectorScale = CreateWorkflow51(VectorScaleTask);
|
|
9943
|
+
// src/task/image/ImageSchemas.ts
|
|
9944
|
+
import { FromSchemaDefaultOptions } from "@workglow/util/schema";
|
|
9945
|
+
var ImageBinaryType = null;
|
|
9946
|
+
var ImageBinarySchemaOptions = {
|
|
9947
|
+
...FromSchemaDefaultOptions,
|
|
9948
|
+
deserialize: [
|
|
9949
|
+
{
|
|
9950
|
+
pattern: { type: "object", format: "image:ImageBinary" },
|
|
9951
|
+
output: ImageBinaryType
|
|
9952
|
+
}
|
|
9953
|
+
]
|
|
9954
|
+
};
|
|
9955
|
+
var ImageBinarySchema = (annotations = {}) => ({
|
|
9956
|
+
type: "object",
|
|
9957
|
+
properties: {
|
|
9958
|
+
data: {
|
|
9959
|
+
type: "array",
|
|
9960
|
+
items: { type: "number", format: "Uint8Clamped" },
|
|
9961
|
+
format: "Uint8ClampedArray",
|
|
9962
|
+
title: "Data",
|
|
9963
|
+
description: "Pixel data of the image"
|
|
9964
|
+
},
|
|
9965
|
+
width: {
|
|
9966
|
+
type: "integer",
|
|
9967
|
+
minimum: 1,
|
|
9968
|
+
title: "Width",
|
|
9969
|
+
description: "Width in pixels"
|
|
9970
|
+
},
|
|
9971
|
+
height: {
|
|
9972
|
+
type: "integer",
|
|
9973
|
+
minimum: 1,
|
|
9974
|
+
title: "Height",
|
|
9975
|
+
description: "Height in pixels"
|
|
9976
|
+
},
|
|
9977
|
+
channels: {
|
|
9978
|
+
type: "integer",
|
|
9979
|
+
enum: [1, 3, 4],
|
|
9980
|
+
title: "Channels",
|
|
9981
|
+
description: "1 (gray), 3 (RGB), or 4 (RGBA)"
|
|
9982
|
+
}
|
|
9983
|
+
},
|
|
9984
|
+
additionalProperties: false,
|
|
9985
|
+
required: ["data", "width", "height", "channels"],
|
|
9986
|
+
format: "image:ImageBinary",
|
|
9987
|
+
title: "Image",
|
|
9988
|
+
description: "Raw pixel image data",
|
|
9989
|
+
...annotations
|
|
9990
|
+
});
|
|
9991
|
+
var ColorSchema = (annotations = {}) => ({
|
|
9992
|
+
type: "object",
|
|
9993
|
+
properties: {
|
|
9994
|
+
r: { type: "integer", minimum: 0, maximum: 255, title: "Red" },
|
|
9995
|
+
g: { type: "integer", minimum: 0, maximum: 255, title: "Green" },
|
|
9996
|
+
b: { type: "integer", minimum: 0, maximum: 255, title: "Blue" },
|
|
9997
|
+
a: { type: "integer", minimum: 0, maximum: 255, title: "Alpha", default: 255 }
|
|
9998
|
+
},
|
|
9999
|
+
required: ["r", "g", "b"],
|
|
10000
|
+
additionalProperties: false,
|
|
10001
|
+
...annotations
|
|
10002
|
+
});
|
|
10003
|
+
// src/task/image/ImageResizeTask.ts
|
|
10004
|
+
import {
|
|
10005
|
+
CreateWorkflow as CreateWorkflow52,
|
|
10006
|
+
Task as Task51,
|
|
10007
|
+
Workflow as Workflow53
|
|
10008
|
+
} from "@workglow/task-graph";
|
|
10009
|
+
var inputSchema45 = {
|
|
10010
|
+
type: "object",
|
|
10011
|
+
properties: {
|
|
10012
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10013
|
+
width: { type: "integer", title: "Width", description: "Target width in pixels", minimum: 1 },
|
|
10014
|
+
height: {
|
|
10015
|
+
type: "integer",
|
|
10016
|
+
title: "Height",
|
|
10017
|
+
description: "Target height in pixels",
|
|
10018
|
+
minimum: 1
|
|
10019
|
+
}
|
|
10020
|
+
},
|
|
10021
|
+
required: ["image", "width", "height"],
|
|
10022
|
+
additionalProperties: false
|
|
10023
|
+
};
|
|
10024
|
+
var outputSchema44 = {
|
|
10025
|
+
type: "object",
|
|
10026
|
+
properties: {
|
|
10027
|
+
image: ImageBinarySchema({ title: "Image", description: "Resized image" })
|
|
10028
|
+
},
|
|
10029
|
+
required: ["image"],
|
|
10030
|
+
additionalProperties: false
|
|
10031
|
+
};
|
|
10032
|
+
|
|
10033
|
+
class ImageResizeTask extends Task51 {
|
|
10034
|
+
static type = "ImageResizeTask";
|
|
10035
|
+
static category = "Image";
|
|
10036
|
+
static title = "Resize Image";
|
|
10037
|
+
static description = "Resizes an image using nearest-neighbor sampling";
|
|
10038
|
+
static inputSchema() {
|
|
10039
|
+
return inputSchema45;
|
|
10040
|
+
}
|
|
10041
|
+
static outputSchema() {
|
|
10042
|
+
return outputSchema44;
|
|
10043
|
+
}
|
|
10044
|
+
async executeReactive(input2, _output, _context) {
|
|
10045
|
+
const { image, width: dstW, height: dstH } = input2;
|
|
10046
|
+
const { data: src, width: srcW, height: srcH, channels } = image;
|
|
10047
|
+
const dst = new Uint8ClampedArray(dstW * dstH * channels);
|
|
10048
|
+
for (let dy = 0;dy < dstH; dy++) {
|
|
10049
|
+
const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
|
|
10050
|
+
for (let dx = 0;dx < dstW; dx++) {
|
|
10051
|
+
const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
|
|
10052
|
+
const srcIdx = (srcY * srcW + srcX) * channels;
|
|
10053
|
+
const dstIdx = (dy * dstW + dx) * channels;
|
|
10054
|
+
for (let c = 0;c < channels; c++) {
|
|
10055
|
+
dst[dstIdx + c] = src[srcIdx + c];
|
|
10056
|
+
}
|
|
10057
|
+
}
|
|
10058
|
+
}
|
|
10059
|
+
return {
|
|
10060
|
+
image: { data: dst, width: dstW, height: dstH, channels }
|
|
10061
|
+
};
|
|
10062
|
+
}
|
|
10063
|
+
}
|
|
10064
|
+
Workflow53.prototype.imageResize = CreateWorkflow52(ImageResizeTask);
|
|
10065
|
+
// src/task/image/ImageCropTask.ts
|
|
10066
|
+
import {
|
|
10067
|
+
CreateWorkflow as CreateWorkflow53,
|
|
10068
|
+
Task as Task52,
|
|
10069
|
+
Workflow as Workflow54
|
|
10070
|
+
} from "@workglow/task-graph";
|
|
10071
|
+
var inputSchema46 = {
|
|
10072
|
+
type: "object",
|
|
10073
|
+
properties: {
|
|
10074
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10075
|
+
x: { type: "integer", title: "X", description: "Left offset", minimum: 0 },
|
|
10076
|
+
y: { type: "integer", title: "Y", description: "Top offset", minimum: 0 },
|
|
10077
|
+
width: { type: "integer", title: "Width", description: "Crop width", minimum: 1 },
|
|
10078
|
+
height: { type: "integer", title: "Height", description: "Crop height", minimum: 1 }
|
|
10079
|
+
},
|
|
10080
|
+
required: ["image", "x", "y", "width", "height"],
|
|
10081
|
+
additionalProperties: false
|
|
10082
|
+
};
|
|
10083
|
+
var outputSchema45 = {
|
|
10084
|
+
type: "object",
|
|
10085
|
+
properties: {
|
|
10086
|
+
image: ImageBinarySchema({ title: "Image", description: "Cropped image" })
|
|
10087
|
+
},
|
|
10088
|
+
required: ["image"],
|
|
10089
|
+
additionalProperties: false
|
|
10090
|
+
};
|
|
10091
|
+
|
|
10092
|
+
class ImageCropTask extends Task52 {
|
|
10093
|
+
static type = "ImageCropTask";
|
|
10094
|
+
static category = "Image";
|
|
10095
|
+
static title = "Crop Image";
|
|
10096
|
+
static description = "Crops an image to a rectangular region";
|
|
10097
|
+
static inputSchema() {
|
|
10098
|
+
return inputSchema46;
|
|
10099
|
+
}
|
|
10100
|
+
static outputSchema() {
|
|
10101
|
+
return outputSchema45;
|
|
10102
|
+
}
|
|
10103
|
+
async executeReactive(input2, _output, _context) {
|
|
10104
|
+
const { image, x: rawX, y: rawY, width: rawW, height: rawH } = input2;
|
|
10105
|
+
const { data: src, width: srcW, height: srcH, channels } = image;
|
|
10106
|
+
if (srcW < 1 || srcH < 1) {
|
|
10107
|
+
throw new RangeError("Cannot crop an empty image");
|
|
10108
|
+
}
|
|
10109
|
+
if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
|
|
10110
|
+
throw new RangeError("Crop origin is outside the source image bounds");
|
|
10111
|
+
}
|
|
10112
|
+
const x = rawX;
|
|
10113
|
+
const y = rawY;
|
|
10114
|
+
const w = Math.min(rawW, srcW - x);
|
|
10115
|
+
const h = Math.min(rawH, srcH - y);
|
|
10116
|
+
const dst = new Uint8ClampedArray(w * h * channels);
|
|
10117
|
+
const rowBytes = w * channels;
|
|
10118
|
+
for (let row = 0;row < h; row++) {
|
|
10119
|
+
const srcOffset = ((y + row) * srcW + x) * channels;
|
|
10120
|
+
const dstOffset = row * rowBytes;
|
|
10121
|
+
dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
|
|
10122
|
+
}
|
|
10123
|
+
return { image: { data: dst, width: w, height: h, channels } };
|
|
10124
|
+
}
|
|
10125
|
+
}
|
|
10126
|
+
Workflow54.prototype.imageCrop = CreateWorkflow53(ImageCropTask);
|
|
10127
|
+
// src/task/image/ImageRotateTask.ts
|
|
10128
|
+
import {
|
|
10129
|
+
CreateWorkflow as CreateWorkflow54,
|
|
10130
|
+
Task as Task53,
|
|
10131
|
+
Workflow as Workflow55
|
|
10132
|
+
} from "@workglow/task-graph";
|
|
10133
|
+
var inputSchema47 = {
|
|
10134
|
+
type: "object",
|
|
10135
|
+
properties: {
|
|
10136
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10137
|
+
angle: {
|
|
10138
|
+
type: "integer",
|
|
10139
|
+
enum: [90, 180, 270],
|
|
10140
|
+
title: "Angle",
|
|
10141
|
+
description: "Rotation angle in degrees (clockwise)"
|
|
10142
|
+
}
|
|
10143
|
+
},
|
|
10144
|
+
required: ["image", "angle"],
|
|
10145
|
+
additionalProperties: false
|
|
10146
|
+
};
|
|
10147
|
+
var outputSchema46 = {
|
|
10148
|
+
type: "object",
|
|
10149
|
+
properties: {
|
|
10150
|
+
image: ImageBinarySchema({ title: "Image", description: "Rotated image" })
|
|
10151
|
+
},
|
|
10152
|
+
required: ["image"],
|
|
10153
|
+
additionalProperties: false
|
|
10154
|
+
};
|
|
10155
|
+
|
|
10156
|
+
class ImageRotateTask extends Task53 {
|
|
10157
|
+
static type = "ImageRotateTask";
|
|
10158
|
+
static category = "Image";
|
|
10159
|
+
static title = "Rotate Image";
|
|
10160
|
+
static description = "Rotates an image by 90, 180, or 270 degrees clockwise";
|
|
10161
|
+
static inputSchema() {
|
|
10162
|
+
return inputSchema47;
|
|
10163
|
+
}
|
|
10164
|
+
static outputSchema() {
|
|
10165
|
+
return outputSchema46;
|
|
10166
|
+
}
|
|
10167
|
+
async executeReactive(input2, _output, _context) {
|
|
10168
|
+
const { image, angle } = input2;
|
|
10169
|
+
const { data: src, width: srcW, height: srcH, channels } = image;
|
|
10170
|
+
const swap = angle === 90 || angle === 270;
|
|
10171
|
+
const dstW = swap ? srcH : srcW;
|
|
10172
|
+
const dstH = swap ? srcW : srcH;
|
|
10173
|
+
const dst = new Uint8ClampedArray(dstW * dstH * channels);
|
|
10174
|
+
for (let sy = 0;sy < srcH; sy++) {
|
|
10175
|
+
for (let sx = 0;sx < srcW; sx++) {
|
|
10176
|
+
let dx, dy;
|
|
10177
|
+
if (angle === 90) {
|
|
10178
|
+
dx = srcH - 1 - sy;
|
|
10179
|
+
dy = sx;
|
|
10180
|
+
} else if (angle === 180) {
|
|
10181
|
+
dx = srcW - 1 - sx;
|
|
10182
|
+
dy = srcH - 1 - sy;
|
|
10183
|
+
} else {
|
|
10184
|
+
dx = sy;
|
|
10185
|
+
dy = srcW - 1 - sx;
|
|
10186
|
+
}
|
|
10187
|
+
const srcIdx = (sy * srcW + sx) * channels;
|
|
10188
|
+
const dstIdx = (dy * dstW + dx) * channels;
|
|
10189
|
+
for (let c = 0;c < channels; c++) {
|
|
10190
|
+
dst[dstIdx + c] = src[srcIdx + c];
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
return {
|
|
10195
|
+
image: { data: dst, width: dstW, height: dstH, channels }
|
|
10196
|
+
};
|
|
10197
|
+
}
|
|
10198
|
+
}
|
|
10199
|
+
Workflow55.prototype.imageRotate = CreateWorkflow54(ImageRotateTask);
|
|
10200
|
+
// src/task/image/ImageFlipTask.ts
|
|
10201
|
+
import {
|
|
10202
|
+
CreateWorkflow as CreateWorkflow55,
|
|
10203
|
+
Task as Task54,
|
|
10204
|
+
Workflow as Workflow56
|
|
10205
|
+
} from "@workglow/task-graph";
|
|
10206
|
+
var inputSchema48 = {
|
|
10207
|
+
type: "object",
|
|
10208
|
+
properties: {
|
|
10209
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10210
|
+
direction: {
|
|
10211
|
+
type: "string",
|
|
10212
|
+
enum: ["horizontal", "vertical"],
|
|
10213
|
+
title: "Direction",
|
|
10214
|
+
description: "Flip direction"
|
|
10215
|
+
}
|
|
10216
|
+
},
|
|
10217
|
+
required: ["image", "direction"],
|
|
10218
|
+
additionalProperties: false
|
|
10219
|
+
};
|
|
10220
|
+
var outputSchema47 = {
|
|
10221
|
+
type: "object",
|
|
10222
|
+
properties: {
|
|
10223
|
+
image: ImageBinarySchema({ title: "Image", description: "Flipped image" })
|
|
10224
|
+
},
|
|
10225
|
+
required: ["image"],
|
|
10226
|
+
additionalProperties: false
|
|
10227
|
+
};
|
|
10228
|
+
|
|
10229
|
+
class ImageFlipTask extends Task54 {
|
|
10230
|
+
static type = "ImageFlipTask";
|
|
10231
|
+
static category = "Image";
|
|
10232
|
+
static title = "Flip Image";
|
|
10233
|
+
static description = "Flips an image horizontally or vertically";
|
|
10234
|
+
static inputSchema() {
|
|
10235
|
+
return inputSchema48;
|
|
10236
|
+
}
|
|
10237
|
+
static outputSchema() {
|
|
10238
|
+
return outputSchema47;
|
|
10239
|
+
}
|
|
10240
|
+
async executeReactive(input2, _output, _context) {
|
|
10241
|
+
const { image, direction } = input2;
|
|
10242
|
+
const { data: src, width, height, channels } = image;
|
|
10243
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10244
|
+
const rowBytes = width * channels;
|
|
10245
|
+
if (direction === "vertical") {
|
|
10246
|
+
for (let y = 0;y < height; y++) {
|
|
10247
|
+
const srcOffset = y * rowBytes;
|
|
10248
|
+
const dstOffset = (height - 1 - y) * rowBytes;
|
|
10249
|
+
dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
|
|
10250
|
+
}
|
|
10251
|
+
} else {
|
|
10252
|
+
for (let y = 0;y < height; y++) {
|
|
10253
|
+
for (let x = 0;x < width; x++) {
|
|
10254
|
+
const srcIdx = (y * width + x) * channels;
|
|
10255
|
+
const dstIdx = (y * width + (width - 1 - x)) * channels;
|
|
10256
|
+
for (let c = 0;c < channels; c++) {
|
|
10257
|
+
dst[dstIdx + c] = src[srcIdx + c];
|
|
10258
|
+
}
|
|
10259
|
+
}
|
|
10260
|
+
}
|
|
10261
|
+
}
|
|
10262
|
+
return { image: { data: dst, width, height, channels } };
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
Workflow56.prototype.imageFlip = CreateWorkflow55(ImageFlipTask);
|
|
10266
|
+
// src/task/image/ImageGrayscaleTask.ts
|
|
10267
|
+
import {
|
|
10268
|
+
CreateWorkflow as CreateWorkflow56,
|
|
10269
|
+
Task as Task55,
|
|
10270
|
+
Workflow as Workflow57
|
|
10271
|
+
} from "@workglow/task-graph";
|
|
10272
|
+
var inputSchema49 = {
|
|
10273
|
+
type: "object",
|
|
10274
|
+
properties: {
|
|
10275
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" })
|
|
10276
|
+
},
|
|
10277
|
+
required: ["image"],
|
|
10278
|
+
additionalProperties: false
|
|
10279
|
+
};
|
|
10280
|
+
var outputSchema48 = {
|
|
10281
|
+
type: "object",
|
|
10282
|
+
properties: {
|
|
10283
|
+
image: ImageBinarySchema({ title: "Image", description: "Grayscale image" })
|
|
10284
|
+
},
|
|
10285
|
+
required: ["image"],
|
|
10286
|
+
additionalProperties: false
|
|
10287
|
+
};
|
|
10288
|
+
|
|
10289
|
+
class ImageGrayscaleTask extends Task55 {
|
|
10290
|
+
static type = "ImageGrayscaleTask";
|
|
10291
|
+
static category = "Image";
|
|
10292
|
+
static title = "Grayscale";
|
|
10293
|
+
static description = "Converts an image to grayscale using luminance";
|
|
10294
|
+
static inputSchema() {
|
|
10295
|
+
return inputSchema49;
|
|
10296
|
+
}
|
|
10297
|
+
static outputSchema() {
|
|
10298
|
+
return outputSchema48;
|
|
10299
|
+
}
|
|
10300
|
+
async executeReactive(input2, _output, _context) {
|
|
10301
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10302
|
+
if (channels === 1) {
|
|
10303
|
+
return { image: { data: new Uint8ClampedArray(src), width, height, channels: 1 } };
|
|
10304
|
+
}
|
|
10305
|
+
const pixelCount = width * height;
|
|
10306
|
+
const dst = new Uint8ClampedArray(pixelCount);
|
|
10307
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
10308
|
+
const idx = i * channels;
|
|
10309
|
+
dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
|
|
10310
|
+
}
|
|
10311
|
+
return { image: { data: dst, width, height, channels: 1 } };
|
|
10312
|
+
}
|
|
10313
|
+
}
|
|
10314
|
+
Workflow57.prototype.imageGrayscale = CreateWorkflow56(ImageGrayscaleTask);
|
|
10315
|
+
// src/task/image/ImageBorderTask.ts
|
|
10316
|
+
import {
|
|
10317
|
+
CreateWorkflow as CreateWorkflow57,
|
|
10318
|
+
Task as Task56,
|
|
10319
|
+
Workflow as Workflow58
|
|
10320
|
+
} from "@workglow/task-graph";
|
|
10321
|
+
var inputSchema50 = {
|
|
10322
|
+
type: "object",
|
|
10323
|
+
properties: {
|
|
10324
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10325
|
+
borderWidth: {
|
|
10326
|
+
type: "integer",
|
|
10327
|
+
title: "Border Width",
|
|
10328
|
+
description: "Border width in pixels",
|
|
10329
|
+
minimum: 1,
|
|
10330
|
+
default: 1
|
|
10331
|
+
},
|
|
10332
|
+
color: ColorSchema({ title: "Color", description: "Border color" })
|
|
10333
|
+
},
|
|
10334
|
+
required: ["image", "color"],
|
|
10335
|
+
additionalProperties: false
|
|
10336
|
+
};
|
|
10337
|
+
var outputSchema49 = {
|
|
10338
|
+
type: "object",
|
|
10339
|
+
properties: {
|
|
10340
|
+
image: ImageBinarySchema({ title: "Image", description: "Image with border" })
|
|
10341
|
+
},
|
|
10342
|
+
required: ["image"],
|
|
10343
|
+
additionalProperties: false
|
|
10344
|
+
};
|
|
10345
|
+
|
|
10346
|
+
class ImageBorderTask extends Task56 {
|
|
10347
|
+
static type = "ImageBorderTask";
|
|
10348
|
+
static category = "Image";
|
|
10349
|
+
static title = "Add Border";
|
|
10350
|
+
static description = "Adds a colored border around an image";
|
|
10351
|
+
static inputSchema() {
|
|
10352
|
+
return inputSchema50;
|
|
10353
|
+
}
|
|
10354
|
+
static outputSchema() {
|
|
10355
|
+
return outputSchema49;
|
|
10356
|
+
}
|
|
10357
|
+
async executeReactive(input2, _output, _context) {
|
|
10358
|
+
const { image, borderWidth: bw = 1, color } = input2;
|
|
10359
|
+
const { data: src, width: srcW, height: srcH, channels: srcCh } = image;
|
|
10360
|
+
const outCh = 4;
|
|
10361
|
+
const dstW = srcW + bw * 2;
|
|
10362
|
+
const dstH = srcH + bw * 2;
|
|
10363
|
+
const dst = new Uint8ClampedArray(dstW * dstH * outCh);
|
|
10364
|
+
const r = color.r;
|
|
10365
|
+
const g = color.g;
|
|
10366
|
+
const b = color.b;
|
|
10367
|
+
const a = color.a ?? 255;
|
|
10368
|
+
for (let i = 0;i < dst.length; i += outCh) {
|
|
10369
|
+
dst[i] = r;
|
|
10370
|
+
dst[i + 1] = g;
|
|
10371
|
+
dst[i + 2] = b;
|
|
10372
|
+
dst[i + 3] = a;
|
|
10373
|
+
}
|
|
10374
|
+
for (let y = 0;y < srcH; y++) {
|
|
10375
|
+
for (let x = 0;x < srcW; x++) {
|
|
10376
|
+
const srcIdx = (y * srcW + x) * srcCh;
|
|
10377
|
+
const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
|
|
10378
|
+
dst[dstIdx] = src[srcIdx];
|
|
10379
|
+
dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
|
|
10380
|
+
dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
|
|
10381
|
+
dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
|
|
10382
|
+
}
|
|
10383
|
+
}
|
|
10384
|
+
return {
|
|
10385
|
+
image: { data: dst, width: dstW, height: dstH, channels: outCh }
|
|
10386
|
+
};
|
|
10387
|
+
}
|
|
10388
|
+
}
|
|
10389
|
+
Workflow58.prototype.imageBorder = CreateWorkflow57(ImageBorderTask);
|
|
10390
|
+
// src/task/image/ImageTransparencyTask.ts
|
|
10391
|
+
import {
|
|
10392
|
+
CreateWorkflow as CreateWorkflow58,
|
|
10393
|
+
Task as Task57,
|
|
10394
|
+
Workflow as Workflow59
|
|
10395
|
+
} from "@workglow/task-graph";
|
|
10396
|
+
var inputSchema51 = {
|
|
10397
|
+
type: "object",
|
|
10398
|
+
properties: {
|
|
10399
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10400
|
+
opacity: {
|
|
10401
|
+
type: "number",
|
|
10402
|
+
title: "Opacity",
|
|
10403
|
+
description: "Opacity level (0.0 = fully transparent, 1.0 = fully opaque)",
|
|
10404
|
+
minimum: 0,
|
|
10405
|
+
maximum: 1
|
|
10406
|
+
}
|
|
10407
|
+
},
|
|
10408
|
+
required: ["image", "opacity"],
|
|
10409
|
+
additionalProperties: false
|
|
10410
|
+
};
|
|
10411
|
+
var outputSchema50 = {
|
|
10412
|
+
type: "object",
|
|
10413
|
+
properties: {
|
|
10414
|
+
image: ImageBinarySchema({ title: "Image", description: "Image with adjusted transparency" })
|
|
10415
|
+
},
|
|
10416
|
+
required: ["image"],
|
|
10417
|
+
additionalProperties: false
|
|
10418
|
+
};
|
|
10419
|
+
|
|
10420
|
+
class ImageTransparencyTask extends Task57 {
|
|
10421
|
+
static type = "ImageTransparencyTask";
|
|
10422
|
+
static category = "Image";
|
|
10423
|
+
static title = "Set Transparency";
|
|
10424
|
+
static description = "Adjusts the opacity of an image";
|
|
10425
|
+
static inputSchema() {
|
|
10426
|
+
return inputSchema51;
|
|
10427
|
+
}
|
|
10428
|
+
static outputSchema() {
|
|
10429
|
+
return outputSchema50;
|
|
10430
|
+
}
|
|
10431
|
+
async executeReactive(input2, _output, _context) {
|
|
10432
|
+
const { image, opacity } = input2;
|
|
10433
|
+
const { data: src, width, height, channels: srcCh } = image;
|
|
10434
|
+
const pixelCount = width * height;
|
|
10435
|
+
const dst = new Uint8ClampedArray(pixelCount * 4);
|
|
10436
|
+
const alphaScale = Math.round(opacity * 255);
|
|
10437
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
10438
|
+
const srcIdx = i * srcCh;
|
|
10439
|
+
const dstIdx = i * 4;
|
|
10440
|
+
dst[dstIdx] = src[srcIdx];
|
|
10441
|
+
dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
|
|
10442
|
+
dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
|
|
10443
|
+
const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
|
|
10444
|
+
dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
|
|
10445
|
+
}
|
|
10446
|
+
return {
|
|
10447
|
+
image: { data: dst, width, height, channels: 4 }
|
|
10448
|
+
};
|
|
10449
|
+
}
|
|
10450
|
+
}
|
|
10451
|
+
Workflow59.prototype.imageTransparency = CreateWorkflow58(ImageTransparencyTask);
|
|
10452
|
+
// src/task/image/ImageBlurTask.ts
|
|
10453
|
+
import {
|
|
10454
|
+
CreateWorkflow as CreateWorkflow59,
|
|
10455
|
+
Task as Task58,
|
|
10456
|
+
Workflow as Workflow60
|
|
10457
|
+
} from "@workglow/task-graph";
|
|
10458
|
+
var inputSchema52 = {
|
|
10459
|
+
type: "object",
|
|
10460
|
+
properties: {
|
|
10461
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10462
|
+
radius: {
|
|
10463
|
+
type: "integer",
|
|
10464
|
+
title: "Radius",
|
|
10465
|
+
description: "Blur radius (1-10)",
|
|
10466
|
+
minimum: 1,
|
|
10467
|
+
maximum: 10,
|
|
10468
|
+
default: 1
|
|
10469
|
+
}
|
|
10470
|
+
},
|
|
10471
|
+
required: ["image"],
|
|
10472
|
+
additionalProperties: false
|
|
10473
|
+
};
|
|
10474
|
+
var outputSchema51 = {
|
|
10475
|
+
type: "object",
|
|
10476
|
+
properties: {
|
|
10477
|
+
image: ImageBinarySchema({ title: "Image", description: "Blurred image" })
|
|
10478
|
+
},
|
|
10479
|
+
required: ["image"],
|
|
10480
|
+
additionalProperties: false
|
|
10481
|
+
};
|
|
10482
|
+
|
|
10483
|
+
class ImageBlurTask extends Task58 {
|
|
10484
|
+
static type = "ImageBlurTask";
|
|
10485
|
+
static category = "Image";
|
|
10486
|
+
static title = "Blur Image";
|
|
10487
|
+
static description = "Applies a box blur to an image";
|
|
10488
|
+
static inputSchema() {
|
|
10489
|
+
return inputSchema52;
|
|
10490
|
+
}
|
|
10491
|
+
static outputSchema() {
|
|
10492
|
+
return outputSchema51;
|
|
10493
|
+
}
|
|
10494
|
+
async executeReactive(input2, _output, _context) {
|
|
10495
|
+
const { image, radius = 1 } = input2;
|
|
10496
|
+
const { data: src, width, height, channels } = image;
|
|
10497
|
+
const kernelSize = radius * 2 + 1;
|
|
10498
|
+
const tmp = new Uint8ClampedArray(src.length);
|
|
10499
|
+
for (let y = 0;y < height; y++) {
|
|
10500
|
+
for (let c = 0;c < channels; c++) {
|
|
10501
|
+
let sum = 0;
|
|
10502
|
+
for (let k = -radius;k <= radius; k++) {
|
|
10503
|
+
const x = Math.max(0, Math.min(k, width - 1));
|
|
10504
|
+
sum += src[(y * width + x) * channels + c];
|
|
10505
|
+
}
|
|
10506
|
+
tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10507
|
+
for (let x = 1;x < width; x++) {
|
|
10508
|
+
const addX = Math.min(x + radius, width - 1);
|
|
10509
|
+
const removeX = Math.max(x - radius - 1, 0);
|
|
10510
|
+
sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
|
|
10511
|
+
tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10512
|
+
}
|
|
10513
|
+
}
|
|
10514
|
+
}
|
|
10515
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10516
|
+
for (let x = 0;x < width; x++) {
|
|
10517
|
+
for (let c = 0;c < channels; c++) {
|
|
10518
|
+
let sum = 0;
|
|
10519
|
+
for (let k = -radius;k <= radius; k++) {
|
|
10520
|
+
const y = Math.max(0, Math.min(k, height - 1));
|
|
10521
|
+
sum += tmp[(y * width + x) * channels + c];
|
|
10522
|
+
}
|
|
10523
|
+
dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10524
|
+
for (let y = 1;y < height; y++) {
|
|
10525
|
+
const addY = Math.min(y + radius, height - 1);
|
|
10526
|
+
const removeY = Math.max(y - radius - 1, 0);
|
|
10527
|
+
sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
|
|
10528
|
+
dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
|
|
10529
|
+
}
|
|
10530
|
+
}
|
|
10531
|
+
}
|
|
10532
|
+
return { image: { data: dst, width, height, channels } };
|
|
10533
|
+
}
|
|
10534
|
+
}
|
|
10535
|
+
Workflow60.prototype.imageBlur = CreateWorkflow59(ImageBlurTask);
|
|
10536
|
+
// src/task/image/ImageWatermarkTask.ts
|
|
10537
|
+
import {
|
|
10538
|
+
CreateWorkflow as CreateWorkflow60,
|
|
10539
|
+
Task as Task59,
|
|
10540
|
+
Workflow as Workflow61
|
|
10541
|
+
} from "@workglow/task-graph";
|
|
10542
|
+
var inputSchema53 = {
|
|
10543
|
+
type: "object",
|
|
10544
|
+
properties: {
|
|
10545
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10546
|
+
spacing: {
|
|
10547
|
+
type: "integer",
|
|
10548
|
+
title: "Spacing",
|
|
10549
|
+
description: "Pattern spacing in pixels",
|
|
10550
|
+
minimum: 8,
|
|
10551
|
+
default: 64
|
|
10552
|
+
},
|
|
10553
|
+
opacity: {
|
|
10554
|
+
type: "number",
|
|
10555
|
+
title: "Opacity",
|
|
10556
|
+
description: "Watermark opacity (0.0-1.0)",
|
|
10557
|
+
minimum: 0,
|
|
10558
|
+
maximum: 1,
|
|
10559
|
+
default: 0.3
|
|
10560
|
+
},
|
|
10561
|
+
pattern: {
|
|
10562
|
+
type: "string",
|
|
10563
|
+
enum: ["diagonal-lines", "grid", "dots"],
|
|
10564
|
+
title: "Pattern",
|
|
10565
|
+
description: "Watermark pattern type",
|
|
10566
|
+
default: "diagonal-lines"
|
|
10567
|
+
}
|
|
10568
|
+
},
|
|
10569
|
+
required: ["image"],
|
|
10570
|
+
additionalProperties: false
|
|
10571
|
+
};
|
|
10572
|
+
var outputSchema52 = {
|
|
10573
|
+
type: "object",
|
|
10574
|
+
properties: {
|
|
10575
|
+
image: ImageBinarySchema({ title: "Image", description: "Watermarked image" })
|
|
10576
|
+
},
|
|
10577
|
+
required: ["image"],
|
|
10578
|
+
additionalProperties: false
|
|
10579
|
+
};
|
|
10580
|
+
|
|
10581
|
+
class ImageWatermarkTask extends Task59 {
|
|
10582
|
+
static type = "ImageWatermarkTask";
|
|
10583
|
+
static category = "Image";
|
|
10584
|
+
static title = "Add Watermark";
|
|
10585
|
+
static description = "Adds a repeating pattern watermark to an image";
|
|
10586
|
+
static inputSchema() {
|
|
10587
|
+
return inputSchema53;
|
|
10588
|
+
}
|
|
10589
|
+
static outputSchema() {
|
|
10590
|
+
return outputSchema52;
|
|
10591
|
+
}
|
|
10592
|
+
async executeReactive(input2, _output, _context) {
|
|
10593
|
+
const { image, spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input2;
|
|
10594
|
+
const { data: src, width, height, channels: srcCh } = image;
|
|
10595
|
+
const outCh = 4;
|
|
10596
|
+
const dst = new Uint8ClampedArray(width * height * outCh);
|
|
10597
|
+
const lineWidth = 2;
|
|
10598
|
+
const dotRadius = Math.max(2, spacing >> 3);
|
|
10599
|
+
const dotRadiusSq = dotRadius * dotRadius;
|
|
10600
|
+
const half = spacing >> 1;
|
|
10601
|
+
const alpha = Math.round(opacity * 255);
|
|
10602
|
+
for (let y = 0;y < height; y++) {
|
|
10603
|
+
for (let x = 0;x < width; x++) {
|
|
10604
|
+
const srcIdx = (y * width + x) * srcCh;
|
|
10605
|
+
const dstIdx = (y * width + x) * outCh;
|
|
10606
|
+
const sr = src[srcIdx];
|
|
10607
|
+
const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
|
|
10608
|
+
const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
|
|
10609
|
+
const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
|
|
10610
|
+
let isPattern = false;
|
|
10611
|
+
if (pattern === "diagonal-lines") {
|
|
10612
|
+
isPattern = (x + y) % spacing < lineWidth;
|
|
10613
|
+
} else if (pattern === "grid") {
|
|
10614
|
+
isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
|
|
10615
|
+
} else {
|
|
10616
|
+
const dx = x % spacing - half;
|
|
10617
|
+
const dy = y % spacing - half;
|
|
10618
|
+
isPattern = dx * dx + dy * dy < dotRadiusSq;
|
|
10619
|
+
}
|
|
10620
|
+
if (isPattern) {
|
|
10621
|
+
const blend = alpha;
|
|
10622
|
+
const invBlend = 255 - blend;
|
|
10623
|
+
dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
|
|
10624
|
+
dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
|
|
10625
|
+
dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
|
|
10626
|
+
dst[dstIdx + 3] = sa;
|
|
10627
|
+
} else {
|
|
10628
|
+
dst[dstIdx] = sr;
|
|
10629
|
+
dst[dstIdx + 1] = sg;
|
|
10630
|
+
dst[dstIdx + 2] = sb;
|
|
10631
|
+
dst[dstIdx + 3] = sa;
|
|
10632
|
+
}
|
|
10633
|
+
}
|
|
10634
|
+
}
|
|
10635
|
+
return {
|
|
10636
|
+
image: { data: dst, width, height, channels: outCh }
|
|
10637
|
+
};
|
|
10638
|
+
}
|
|
10639
|
+
}
|
|
10640
|
+
Workflow61.prototype.imageWatermark = CreateWorkflow60(ImageWatermarkTask);
|
|
10641
|
+
// src/task/image/ImagePixelateTask.ts
|
|
10642
|
+
import {
|
|
10643
|
+
CreateWorkflow as CreateWorkflow61,
|
|
10644
|
+
Task as Task60,
|
|
10645
|
+
Workflow as Workflow62
|
|
10646
|
+
} from "@workglow/task-graph";
|
|
10647
|
+
var inputSchema54 = {
|
|
10648
|
+
type: "object",
|
|
10649
|
+
properties: {
|
|
10650
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10651
|
+
blockSize: {
|
|
10652
|
+
type: "integer",
|
|
10653
|
+
title: "Block Size",
|
|
10654
|
+
description: "Size of each pixelation block",
|
|
10655
|
+
minimum: 2,
|
|
10656
|
+
default: 8
|
|
10657
|
+
}
|
|
10658
|
+
},
|
|
10659
|
+
required: ["image"],
|
|
10660
|
+
additionalProperties: false
|
|
10661
|
+
};
|
|
10662
|
+
var outputSchema53 = {
|
|
10663
|
+
type: "object",
|
|
10664
|
+
properties: {
|
|
10665
|
+
image: ImageBinarySchema({ title: "Image", description: "Pixelated image" })
|
|
10666
|
+
},
|
|
10667
|
+
required: ["image"],
|
|
10668
|
+
additionalProperties: false
|
|
10669
|
+
};
|
|
10670
|
+
|
|
10671
|
+
class ImagePixelateTask extends Task60 {
|
|
10672
|
+
static type = "ImagePixelateTask";
|
|
10673
|
+
static category = "Image";
|
|
10674
|
+
static title = "Pixelate Image";
|
|
10675
|
+
static description = "Pixelates an image by averaging blocks of pixels";
|
|
10676
|
+
static inputSchema() {
|
|
10677
|
+
return inputSchema54;
|
|
10678
|
+
}
|
|
10679
|
+
static outputSchema() {
|
|
10680
|
+
return outputSchema53;
|
|
10681
|
+
}
|
|
10682
|
+
async executeReactive(input2, _output, _context) {
|
|
10683
|
+
const { image, blockSize = 8 } = input2;
|
|
10684
|
+
const { data: src, width, height, channels } = image;
|
|
10685
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10686
|
+
for (let by = 0;by < height; by += blockSize) {
|
|
10687
|
+
const blockH = Math.min(blockSize, height - by);
|
|
10688
|
+
for (let bx = 0;bx < width; bx += blockSize) {
|
|
10689
|
+
const blockW = Math.min(blockSize, width - bx);
|
|
10690
|
+
const blockArea = blockW * blockH;
|
|
10691
|
+
const sums = new Array(channels).fill(0);
|
|
10692
|
+
for (let y = by;y < by + blockH; y++) {
|
|
10693
|
+
for (let x = bx;x < bx + blockW; x++) {
|
|
10694
|
+
const idx = (y * width + x) * channels;
|
|
10695
|
+
for (let c = 0;c < channels; c++) {
|
|
10696
|
+
sums[c] += src[idx + c];
|
|
10697
|
+
}
|
|
10698
|
+
}
|
|
10699
|
+
}
|
|
10700
|
+
const avg = sums.map((s) => s / blockArea + 0.5 | 0);
|
|
10701
|
+
for (let y = by;y < by + blockH; y++) {
|
|
10702
|
+
for (let x = bx;x < bx + blockW; x++) {
|
|
10703
|
+
const idx = (y * width + x) * channels;
|
|
10704
|
+
for (let c = 0;c < channels; c++) {
|
|
10705
|
+
dst[idx + c] = avg[c];
|
|
10706
|
+
}
|
|
10707
|
+
}
|
|
10708
|
+
}
|
|
10709
|
+
}
|
|
10710
|
+
}
|
|
10711
|
+
return { image: { data: dst, width, height, channels } };
|
|
10712
|
+
}
|
|
10713
|
+
}
|
|
10714
|
+
Workflow62.prototype.imagePixelate = CreateWorkflow61(ImagePixelateTask);
|
|
10715
|
+
// src/task/image/ImageInvertTask.ts
|
|
10716
|
+
import {
|
|
10717
|
+
CreateWorkflow as CreateWorkflow62,
|
|
10718
|
+
Task as Task61,
|
|
10719
|
+
Workflow as Workflow63
|
|
10720
|
+
} from "@workglow/task-graph";
|
|
10721
|
+
var inputSchema55 = {
|
|
10722
|
+
type: "object",
|
|
10723
|
+
properties: {
|
|
10724
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" })
|
|
10725
|
+
},
|
|
10726
|
+
required: ["image"],
|
|
10727
|
+
additionalProperties: false
|
|
10728
|
+
};
|
|
10729
|
+
var outputSchema54 = {
|
|
10730
|
+
type: "object",
|
|
10731
|
+
properties: {
|
|
10732
|
+
image: ImageBinarySchema({ title: "Image", description: "Inverted image" })
|
|
10733
|
+
},
|
|
10734
|
+
required: ["image"],
|
|
10735
|
+
additionalProperties: false
|
|
10736
|
+
};
|
|
10737
|
+
|
|
10738
|
+
class ImageInvertTask extends Task61 {
|
|
10739
|
+
static type = "ImageInvertTask";
|
|
10740
|
+
static category = "Image";
|
|
10741
|
+
static title = "Invert Colors";
|
|
10742
|
+
static description = "Inverts the colors of an image";
|
|
10743
|
+
static inputSchema() {
|
|
10744
|
+
return inputSchema55;
|
|
10745
|
+
}
|
|
10746
|
+
static outputSchema() {
|
|
10747
|
+
return outputSchema54;
|
|
10748
|
+
}
|
|
10749
|
+
async executeReactive(input2, _output, _context) {
|
|
10750
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10751
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10752
|
+
if (channels === 4) {
|
|
10753
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
10754
|
+
dst[i] = 255 - src[i];
|
|
10755
|
+
dst[i + 1] = 255 - src[i + 1];
|
|
10756
|
+
dst[i + 2] = 255 - src[i + 2];
|
|
10757
|
+
dst[i + 3] = src[i + 3];
|
|
10758
|
+
}
|
|
10759
|
+
} else {
|
|
10760
|
+
for (let i = 0;i < src.length; i++) {
|
|
10761
|
+
dst[i] = 255 - src[i];
|
|
10762
|
+
}
|
|
10763
|
+
}
|
|
10764
|
+
return { image: { data: dst, width, height, channels } };
|
|
10765
|
+
}
|
|
10766
|
+
}
|
|
10767
|
+
Workflow63.prototype.imageInvert = CreateWorkflow62(ImageInvertTask);
|
|
10768
|
+
// src/task/image/ImageBrightnessTask.ts
|
|
10769
|
+
import {
|
|
10770
|
+
CreateWorkflow as CreateWorkflow63,
|
|
10771
|
+
Task as Task62,
|
|
10772
|
+
Workflow as Workflow64
|
|
10773
|
+
} from "@workglow/task-graph";
|
|
10774
|
+
var inputSchema56 = {
|
|
10775
|
+
type: "object",
|
|
10776
|
+
properties: {
|
|
10777
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10778
|
+
amount: {
|
|
10779
|
+
type: "number",
|
|
10780
|
+
title: "Amount",
|
|
10781
|
+
description: "Brightness adjustment (-255 to 255)",
|
|
10782
|
+
minimum: -255,
|
|
10783
|
+
maximum: 255,
|
|
10784
|
+
default: 0
|
|
10785
|
+
}
|
|
10786
|
+
},
|
|
10787
|
+
required: ["image"],
|
|
10788
|
+
additionalProperties: false
|
|
10789
|
+
};
|
|
10790
|
+
var outputSchema55 = {
|
|
10791
|
+
type: "object",
|
|
10792
|
+
properties: {
|
|
10793
|
+
image: ImageBinarySchema({ title: "Image", description: "Brightness-adjusted image" })
|
|
10794
|
+
},
|
|
10795
|
+
required: ["image"],
|
|
10796
|
+
additionalProperties: false
|
|
10797
|
+
};
|
|
10798
|
+
|
|
10799
|
+
class ImageBrightnessTask extends Task62 {
|
|
10800
|
+
static type = "ImageBrightnessTask";
|
|
10801
|
+
static category = "Image";
|
|
10802
|
+
static title = "Adjust Brightness";
|
|
10803
|
+
static description = "Adjusts the brightness of an image";
|
|
10804
|
+
static inputSchema() {
|
|
10805
|
+
return inputSchema56;
|
|
10806
|
+
}
|
|
10807
|
+
static outputSchema() {
|
|
10808
|
+
return outputSchema55;
|
|
10809
|
+
}
|
|
10810
|
+
async executeReactive(input2, _output, _context) {
|
|
10811
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10812
|
+
const amount = input2.amount ?? 0;
|
|
10813
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10814
|
+
if (channels === 4) {
|
|
10815
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
10816
|
+
dst[i] = src[i] + amount;
|
|
10817
|
+
dst[i + 1] = src[i + 1] + amount;
|
|
10818
|
+
dst[i + 2] = src[i + 2] + amount;
|
|
10819
|
+
dst[i + 3] = src[i + 3];
|
|
10820
|
+
}
|
|
10821
|
+
} else {
|
|
10822
|
+
for (let i = 0;i < src.length; i++) {
|
|
10823
|
+
dst[i] = src[i] + amount;
|
|
10824
|
+
}
|
|
10825
|
+
}
|
|
10826
|
+
return { image: { data: dst, width, height, channels } };
|
|
10827
|
+
}
|
|
10828
|
+
}
|
|
10829
|
+
Workflow64.prototype.imageBrightness = CreateWorkflow63(ImageBrightnessTask);
|
|
10830
|
+
// src/task/image/ImageContrastTask.ts
|
|
10831
|
+
import {
|
|
10832
|
+
CreateWorkflow as CreateWorkflow64,
|
|
10833
|
+
Task as Task63,
|
|
10834
|
+
Workflow as Workflow65
|
|
10835
|
+
} from "@workglow/task-graph";
|
|
10836
|
+
var inputSchema57 = {
|
|
10837
|
+
type: "object",
|
|
10838
|
+
properties: {
|
|
10839
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10840
|
+
amount: {
|
|
10841
|
+
type: "number",
|
|
10842
|
+
title: "Amount",
|
|
10843
|
+
description: "Contrast adjustment (-100 to 100)",
|
|
10844
|
+
minimum: -100,
|
|
10845
|
+
maximum: 100,
|
|
10846
|
+
default: 0
|
|
10847
|
+
}
|
|
10848
|
+
},
|
|
10849
|
+
required: ["image"],
|
|
10850
|
+
additionalProperties: false
|
|
10851
|
+
};
|
|
10852
|
+
var outputSchema56 = {
|
|
10853
|
+
type: "object",
|
|
10854
|
+
properties: {
|
|
10855
|
+
image: ImageBinarySchema({ title: "Image", description: "Contrast-adjusted image" })
|
|
10856
|
+
},
|
|
10857
|
+
required: ["image"],
|
|
10858
|
+
additionalProperties: false
|
|
10859
|
+
};
|
|
10860
|
+
|
|
10861
|
+
class ImageContrastTask extends Task63 {
|
|
10862
|
+
static type = "ImageContrastTask";
|
|
10863
|
+
static category = "Image";
|
|
10864
|
+
static title = "Adjust Contrast";
|
|
10865
|
+
static description = "Adjusts the contrast of an image";
|
|
10866
|
+
static inputSchema() {
|
|
10867
|
+
return inputSchema57;
|
|
10868
|
+
}
|
|
10869
|
+
static outputSchema() {
|
|
10870
|
+
return outputSchema56;
|
|
10871
|
+
}
|
|
10872
|
+
async executeReactive(input2, _output, _context) {
|
|
10873
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10874
|
+
const amount = input2.amount ?? 0;
|
|
10875
|
+
const factor = 259 * (amount + 255) / (255 * (259 - amount));
|
|
10876
|
+
const lut = new Uint8ClampedArray(256);
|
|
10877
|
+
for (let i = 0;i < 256; i++) {
|
|
10878
|
+
lut[i] = factor * (i - 128) + 128;
|
|
10879
|
+
}
|
|
10880
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10881
|
+
if (channels === 4) {
|
|
10882
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
10883
|
+
dst[i] = lut[src[i]];
|
|
10884
|
+
dst[i + 1] = lut[src[i + 1]];
|
|
10885
|
+
dst[i + 2] = lut[src[i + 2]];
|
|
10886
|
+
dst[i + 3] = src[i + 3];
|
|
10887
|
+
}
|
|
10888
|
+
} else {
|
|
10889
|
+
for (let i = 0;i < src.length; i++) {
|
|
10890
|
+
dst[i] = lut[src[i]];
|
|
10891
|
+
}
|
|
10892
|
+
}
|
|
10893
|
+
return { image: { data: dst, width, height, channels } };
|
|
10894
|
+
}
|
|
10895
|
+
}
|
|
10896
|
+
Workflow65.prototype.imageContrast = CreateWorkflow64(ImageContrastTask);
|
|
10897
|
+
// src/task/image/ImageSepiaTask.ts
|
|
10898
|
+
import {
|
|
10899
|
+
CreateWorkflow as CreateWorkflow65,
|
|
10900
|
+
Task as Task64,
|
|
10901
|
+
Workflow as Workflow66
|
|
10902
|
+
} from "@workglow/task-graph";
|
|
10903
|
+
var inputSchema58 = {
|
|
10904
|
+
type: "object",
|
|
10905
|
+
properties: {
|
|
10906
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" })
|
|
10907
|
+
},
|
|
10908
|
+
required: ["image"],
|
|
10909
|
+
additionalProperties: false
|
|
10910
|
+
};
|
|
10911
|
+
var outputSchema57 = {
|
|
10912
|
+
type: "object",
|
|
10913
|
+
properties: {
|
|
10914
|
+
image: ImageBinarySchema({ title: "Image", description: "Sepia-toned image" })
|
|
10915
|
+
},
|
|
10916
|
+
required: ["image"],
|
|
10917
|
+
additionalProperties: false
|
|
10918
|
+
};
|
|
10919
|
+
|
|
10920
|
+
class ImageSepiaTask extends Task64 {
|
|
10921
|
+
static type = "ImageSepiaTask";
|
|
10922
|
+
static category = "Image";
|
|
10923
|
+
static title = "Sepia Tone";
|
|
10924
|
+
static description = "Applies a sepia tone filter to an image";
|
|
10925
|
+
static inputSchema() {
|
|
10926
|
+
return inputSchema58;
|
|
10927
|
+
}
|
|
10928
|
+
static outputSchema() {
|
|
10929
|
+
return outputSchema57;
|
|
10930
|
+
}
|
|
10931
|
+
async executeReactive(input2, _output, _context) {
|
|
10932
|
+
const { data: src, width, height, channels } = input2.image;
|
|
10933
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
10934
|
+
const pixelCount = width * height;
|
|
10935
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
10936
|
+
const idx = i * channels;
|
|
10937
|
+
const r = channels === 1 ? src[idx] : src[idx];
|
|
10938
|
+
const g = channels === 1 ? src[idx] : src[idx + 1];
|
|
10939
|
+
const b = channels === 1 ? src[idx] : src[idx + 2];
|
|
10940
|
+
const outR = r * 402 + g * 787 + b * 194 >> 10;
|
|
10941
|
+
const outG = r * 357 + g * 702 + b * 172 >> 10;
|
|
10942
|
+
const outB = r * 279 + g * 547 + b * 134 >> 10;
|
|
10943
|
+
dst[idx] = outR > 255 ? 255 : outR;
|
|
10944
|
+
if (channels >= 3) {
|
|
10945
|
+
dst[idx + 1] = outG > 255 ? 255 : outG;
|
|
10946
|
+
dst[idx + 2] = outB > 255 ? 255 : outB;
|
|
10947
|
+
}
|
|
10948
|
+
if (channels === 4) {
|
|
10949
|
+
dst[idx + 3] = src[idx + 3];
|
|
10950
|
+
}
|
|
10951
|
+
}
|
|
10952
|
+
return { image: { data: dst, width, height, channels } };
|
|
10953
|
+
}
|
|
10954
|
+
}
|
|
10955
|
+
Workflow66.prototype.imageSepia = CreateWorkflow65(ImageSepiaTask);
|
|
10956
|
+
// src/task/image/ImageThresholdTask.ts
|
|
10957
|
+
import {
|
|
10958
|
+
CreateWorkflow as CreateWorkflow66,
|
|
10959
|
+
Task as Task65,
|
|
10960
|
+
Workflow as Workflow67
|
|
10961
|
+
} from "@workglow/task-graph";
|
|
10962
|
+
var inputSchema59 = {
|
|
10963
|
+
type: "object",
|
|
10964
|
+
properties: {
|
|
10965
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
10966
|
+
threshold: {
|
|
10967
|
+
type: "integer",
|
|
10968
|
+
title: "Threshold",
|
|
10969
|
+
description: "Threshold value (0-255)",
|
|
10970
|
+
minimum: 0,
|
|
10971
|
+
maximum: 255,
|
|
10972
|
+
default: 128
|
|
10973
|
+
}
|
|
10974
|
+
},
|
|
10975
|
+
required: ["image"],
|
|
10976
|
+
additionalProperties: false
|
|
10977
|
+
};
|
|
10978
|
+
var outputSchema58 = {
|
|
10979
|
+
type: "object",
|
|
10980
|
+
properties: {
|
|
10981
|
+
image: ImageBinarySchema({ title: "Image", description: "Thresholded binary image" })
|
|
10982
|
+
},
|
|
10983
|
+
required: ["image"],
|
|
10984
|
+
additionalProperties: false
|
|
10985
|
+
};
|
|
10986
|
+
|
|
10987
|
+
class ImageThresholdTask extends Task65 {
|
|
10988
|
+
static type = "ImageThresholdTask";
|
|
10989
|
+
static category = "Image";
|
|
10990
|
+
static title = "Threshold";
|
|
10991
|
+
static description = "Converts an image to binary black and white";
|
|
10992
|
+
static inputSchema() {
|
|
10993
|
+
return inputSchema59;
|
|
10994
|
+
}
|
|
10995
|
+
static outputSchema() {
|
|
10996
|
+
return outputSchema58;
|
|
10997
|
+
}
|
|
10998
|
+
async executeReactive(input2, _output, _context) {
|
|
10999
|
+
const { data: src, width, height, channels } = input2.image;
|
|
11000
|
+
const threshold = input2.threshold ?? 128;
|
|
11001
|
+
const pixelCount = width * height;
|
|
11002
|
+
const dst = new Uint8ClampedArray(pixelCount);
|
|
11003
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
11004
|
+
const idx = i * channels;
|
|
11005
|
+
let gray;
|
|
11006
|
+
if (channels === 1) {
|
|
11007
|
+
gray = src[idx];
|
|
11008
|
+
} else {
|
|
11009
|
+
gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
|
|
11010
|
+
}
|
|
11011
|
+
dst[i] = gray >= threshold ? 255 : 0;
|
|
11012
|
+
}
|
|
11013
|
+
return { image: { data: dst, width, height, channels: 1 } };
|
|
11014
|
+
}
|
|
11015
|
+
}
|
|
11016
|
+
Workflow67.prototype.imageThreshold = CreateWorkflow66(ImageThresholdTask);
|
|
11017
|
+
// src/task/image/ImagePosterizeTask.ts
|
|
11018
|
+
import {
|
|
11019
|
+
CreateWorkflow as CreateWorkflow67,
|
|
11020
|
+
Task as Task66,
|
|
11021
|
+
Workflow as Workflow68
|
|
11022
|
+
} from "@workglow/task-graph";
|
|
11023
|
+
var inputSchema60 = {
|
|
11024
|
+
type: "object",
|
|
11025
|
+
properties: {
|
|
11026
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
11027
|
+
levels: {
|
|
11028
|
+
type: "integer",
|
|
11029
|
+
title: "Levels",
|
|
11030
|
+
description: "Number of color levels per channel (2-32)",
|
|
11031
|
+
minimum: 2,
|
|
11032
|
+
maximum: 32,
|
|
11033
|
+
default: 4
|
|
11034
|
+
}
|
|
11035
|
+
},
|
|
11036
|
+
required: ["image"],
|
|
11037
|
+
additionalProperties: false
|
|
11038
|
+
};
|
|
11039
|
+
var outputSchema59 = {
|
|
11040
|
+
type: "object",
|
|
11041
|
+
properties: {
|
|
11042
|
+
image: ImageBinarySchema({ title: "Image", description: "Posterized image" })
|
|
11043
|
+
},
|
|
11044
|
+
required: ["image"],
|
|
11045
|
+
additionalProperties: false
|
|
11046
|
+
};
|
|
11047
|
+
|
|
11048
|
+
class ImagePosterizeTask extends Task66 {
|
|
11049
|
+
static type = "ImagePosterizeTask";
|
|
11050
|
+
static category = "Image";
|
|
11051
|
+
static title = "Posterize";
|
|
11052
|
+
static description = "Reduces the number of color levels in an image";
|
|
11053
|
+
static inputSchema() {
|
|
11054
|
+
return inputSchema60;
|
|
11055
|
+
}
|
|
11056
|
+
static outputSchema() {
|
|
11057
|
+
return outputSchema59;
|
|
11058
|
+
}
|
|
11059
|
+
async executeReactive(input2, _output, _context) {
|
|
11060
|
+
const { data: src, width, height, channels } = input2.image;
|
|
11061
|
+
const levels = input2.levels ?? 4;
|
|
11062
|
+
const step = 255 / (levels - 1);
|
|
11063
|
+
const lut = new Uint8ClampedArray(256);
|
|
11064
|
+
for (let i = 0;i < 256; i++) {
|
|
11065
|
+
lut[i] = Math.round(Math.round(i / step) * step);
|
|
11066
|
+
}
|
|
11067
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
11068
|
+
if (channels === 4) {
|
|
11069
|
+
for (let i = 0;i < src.length; i += 4) {
|
|
11070
|
+
dst[i] = lut[src[i]];
|
|
11071
|
+
dst[i + 1] = lut[src[i + 1]];
|
|
11072
|
+
dst[i + 2] = lut[src[i + 2]];
|
|
11073
|
+
dst[i + 3] = src[i + 3];
|
|
11074
|
+
}
|
|
11075
|
+
} else {
|
|
11076
|
+
for (let i = 0;i < src.length; i++) {
|
|
11077
|
+
dst[i] = lut[src[i]];
|
|
11078
|
+
}
|
|
11079
|
+
}
|
|
11080
|
+
return { image: { data: dst, width, height, channels } };
|
|
11081
|
+
}
|
|
11082
|
+
}
|
|
11083
|
+
Workflow68.prototype.imagePosterize = CreateWorkflow67(ImagePosterizeTask);
|
|
11084
|
+
// src/task/image/ImageTintTask.ts
|
|
11085
|
+
import {
|
|
11086
|
+
CreateWorkflow as CreateWorkflow68,
|
|
11087
|
+
Task as Task67,
|
|
11088
|
+
Workflow as Workflow69
|
|
11089
|
+
} from "@workglow/task-graph";
|
|
11090
|
+
var inputSchema61 = {
|
|
11091
|
+
type: "object",
|
|
11092
|
+
properties: {
|
|
11093
|
+
image: ImageBinarySchema({ title: "Image", description: "Source image" }),
|
|
11094
|
+
color: ColorSchema({ title: "Color", description: "Tint color" }),
|
|
11095
|
+
amount: {
|
|
11096
|
+
type: "number",
|
|
11097
|
+
title: "Amount",
|
|
11098
|
+
description: "Tint strength (0.0 = no tint, 1.0 = full tint color)",
|
|
11099
|
+
minimum: 0,
|
|
11100
|
+
maximum: 1,
|
|
11101
|
+
default: 0.5
|
|
11102
|
+
}
|
|
11103
|
+
},
|
|
11104
|
+
required: ["image", "color"],
|
|
11105
|
+
additionalProperties: false
|
|
11106
|
+
};
|
|
11107
|
+
var outputSchema60 = {
|
|
11108
|
+
type: "object",
|
|
11109
|
+
properties: {
|
|
11110
|
+
image: ImageBinarySchema({ title: "Image", description: "Tinted image" })
|
|
11111
|
+
},
|
|
11112
|
+
required: ["image"],
|
|
11113
|
+
additionalProperties: false
|
|
11114
|
+
};
|
|
11115
|
+
|
|
11116
|
+
class ImageTintTask extends Task67 {
|
|
11117
|
+
static type = "ImageTintTask";
|
|
11118
|
+
static category = "Image";
|
|
11119
|
+
static title = "Tint Image";
|
|
11120
|
+
static description = "Applies a color tint to an image";
|
|
11121
|
+
static inputSchema() {
|
|
11122
|
+
return inputSchema61;
|
|
11123
|
+
}
|
|
11124
|
+
static outputSchema() {
|
|
11125
|
+
return outputSchema60;
|
|
11126
|
+
}
|
|
11127
|
+
async executeReactive(input2, _output, _context) {
|
|
11128
|
+
const { data: src, width, height, channels } = input2.image;
|
|
11129
|
+
const { r: tr, g: tg, b: tb } = input2.color;
|
|
11130
|
+
const amount = input2.amount ?? 0.5;
|
|
11131
|
+
const invAmount = 1 - amount;
|
|
11132
|
+
const tintR = tr * amount;
|
|
11133
|
+
const tintG = tg * amount;
|
|
11134
|
+
const tintB = tb * amount;
|
|
11135
|
+
const pixelCount = width * height;
|
|
11136
|
+
if (channels === 1) {
|
|
11137
|
+
const dst2 = new Uint8ClampedArray(pixelCount * 3);
|
|
11138
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
11139
|
+
const gray = src[i];
|
|
11140
|
+
dst2[i * 3] = gray * invAmount + tintR;
|
|
11141
|
+
dst2[i * 3 + 1] = gray * invAmount + tintG;
|
|
11142
|
+
dst2[i * 3 + 2] = gray * invAmount + tintB;
|
|
11143
|
+
}
|
|
11144
|
+
return { image: { data: dst2, width, height, channels: 3 } };
|
|
11145
|
+
}
|
|
11146
|
+
const dst = new Uint8ClampedArray(src.length);
|
|
11147
|
+
for (let i = 0;i < pixelCount; i++) {
|
|
11148
|
+
const idx = i * channels;
|
|
11149
|
+
dst[idx] = src[idx] * invAmount + tintR;
|
|
11150
|
+
dst[idx + 1] = src[idx + 1] * invAmount + tintG;
|
|
11151
|
+
dst[idx + 2] = src[idx + 2] * invAmount + tintB;
|
|
11152
|
+
if (channels === 4) {
|
|
11153
|
+
dst[idx + 3] = src[idx + 3];
|
|
11154
|
+
}
|
|
11155
|
+
}
|
|
11156
|
+
return { image: { data: dst, width, height, channels } };
|
|
11157
|
+
}
|
|
11158
|
+
}
|
|
11159
|
+
Workflow69.prototype.imageTint = CreateWorkflow68(ImageTintTask);
|
|
9943
11160
|
|
|
9944
11161
|
// src/common.ts
|
|
9945
11162
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
@@ -9995,28 +11212,45 @@ var registerCommonTasks = () => {
|
|
|
9995
11212
|
JsonPathTask,
|
|
9996
11213
|
TemplateTask,
|
|
9997
11214
|
DateFormatTask,
|
|
9998
|
-
RegexTask
|
|
11215
|
+
RegexTask,
|
|
11216
|
+
ImageResizeTask,
|
|
11217
|
+
ImageCropTask,
|
|
11218
|
+
ImageRotateTask,
|
|
11219
|
+
ImageFlipTask,
|
|
11220
|
+
ImageGrayscaleTask,
|
|
11221
|
+
ImageBorderTask,
|
|
11222
|
+
ImageTransparencyTask,
|
|
11223
|
+
ImageBlurTask,
|
|
11224
|
+
ImageWatermarkTask,
|
|
11225
|
+
ImagePixelateTask,
|
|
11226
|
+
ImageInvertTask,
|
|
11227
|
+
ImageBrightnessTask,
|
|
11228
|
+
ImageContrastTask,
|
|
11229
|
+
ImageSepiaTask,
|
|
11230
|
+
ImageThresholdTask,
|
|
11231
|
+
ImagePosterizeTask,
|
|
11232
|
+
ImageTintTask
|
|
9999
11233
|
];
|
|
10000
11234
|
tasks.map(TaskRegistry.registerTask);
|
|
10001
11235
|
return tasks;
|
|
10002
11236
|
};
|
|
10003
11237
|
// src/task/FileLoaderTask.server.ts
|
|
10004
11238
|
import {
|
|
10005
|
-
CreateWorkflow as
|
|
11239
|
+
CreateWorkflow as CreateWorkflow70,
|
|
10006
11240
|
TaskAbortedError as TaskAbortedError5,
|
|
10007
|
-
Workflow as
|
|
11241
|
+
Workflow as Workflow71
|
|
10008
11242
|
} from "@workglow/task-graph";
|
|
10009
11243
|
import { readFile } from "node:fs/promises";
|
|
10010
11244
|
|
|
10011
11245
|
// src/task/FileLoaderTask.ts
|
|
10012
11246
|
import {
|
|
10013
|
-
CreateWorkflow as
|
|
10014
|
-
Task as
|
|
11247
|
+
CreateWorkflow as CreateWorkflow69,
|
|
11248
|
+
Task as Task68,
|
|
10015
11249
|
TaskAbortedError as TaskAbortedError4,
|
|
10016
|
-
Workflow as
|
|
11250
|
+
Workflow as Workflow70
|
|
10017
11251
|
} from "@workglow/task-graph";
|
|
10018
11252
|
import Papa from "papaparse";
|
|
10019
|
-
var
|
|
11253
|
+
var inputSchema62 = {
|
|
10020
11254
|
type: "object",
|
|
10021
11255
|
properties: {
|
|
10022
11256
|
url: {
|
|
@@ -10036,7 +11270,7 @@ var inputSchema45 = {
|
|
|
10036
11270
|
required: ["url"],
|
|
10037
11271
|
additionalProperties: false
|
|
10038
11272
|
};
|
|
10039
|
-
var
|
|
11273
|
+
var outputSchema61 = {
|
|
10040
11274
|
type: "object",
|
|
10041
11275
|
properties: {
|
|
10042
11276
|
text: {
|
|
@@ -10087,17 +11321,17 @@ var outputSchema44 = {
|
|
|
10087
11321
|
additionalProperties: false
|
|
10088
11322
|
};
|
|
10089
11323
|
|
|
10090
|
-
class FileLoaderTask extends
|
|
11324
|
+
class FileLoaderTask extends Task68 {
|
|
10091
11325
|
static type = "FileLoaderTask";
|
|
10092
11326
|
static category = "Document";
|
|
10093
11327
|
static title = "File Loader";
|
|
10094
11328
|
static description = "Load documents from URLs (http://, https://)";
|
|
10095
11329
|
static cacheable = true;
|
|
10096
11330
|
static inputSchema() {
|
|
10097
|
-
return
|
|
11331
|
+
return inputSchema62;
|
|
10098
11332
|
}
|
|
10099
11333
|
static outputSchema() {
|
|
10100
|
-
return
|
|
11334
|
+
return outputSchema61;
|
|
10101
11335
|
}
|
|
10102
11336
|
async execute(input2, context) {
|
|
10103
11337
|
const { url, format = "auto" } = input2;
|
|
@@ -10446,7 +11680,7 @@ class FileLoaderTask extends Task51 {
|
|
|
10446
11680
|
});
|
|
10447
11681
|
}
|
|
10448
11682
|
}
|
|
10449
|
-
|
|
11683
|
+
Workflow70.prototype.fileLoader = CreateWorkflow69(FileLoaderTask);
|
|
10450
11684
|
|
|
10451
11685
|
// src/task/FileLoaderTask.server.ts
|
|
10452
11686
|
class FileLoaderTask2 extends FileLoaderTask {
|
|
@@ -10635,7 +11869,7 @@ class FileLoaderTask2 extends FileLoaderTask {
|
|
|
10635
11869
|
var fileLoader = (input2, config) => {
|
|
10636
11870
|
return new FileLoaderTask2(config).run(input2);
|
|
10637
11871
|
};
|
|
10638
|
-
|
|
11872
|
+
Workflow71.prototype.fileLoader = CreateWorkflow70(FileLoaderTask2);
|
|
10639
11873
|
|
|
10640
11874
|
// src/node.ts
|
|
10641
11875
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
@@ -10747,6 +11981,25 @@ export {
|
|
|
10747
11981
|
JavaScriptTask,
|
|
10748
11982
|
InputTask,
|
|
10749
11983
|
InMemoryMcpServerRepository,
|
|
11984
|
+
ImageWatermarkTask,
|
|
11985
|
+
ImageTransparencyTask,
|
|
11986
|
+
ImageTintTask,
|
|
11987
|
+
ImageThresholdTask,
|
|
11988
|
+
ImageSepiaTask,
|
|
11989
|
+
ImageRotateTask,
|
|
11990
|
+
ImageResizeTask,
|
|
11991
|
+
ImagePosterizeTask,
|
|
11992
|
+
ImagePixelateTask,
|
|
11993
|
+
ImageInvertTask,
|
|
11994
|
+
ImageGrayscaleTask,
|
|
11995
|
+
ImageFlipTask,
|
|
11996
|
+
ImageCropTask,
|
|
11997
|
+
ImageContrastTask,
|
|
11998
|
+
ImageBrightnessTask,
|
|
11999
|
+
ImageBorderTask,
|
|
12000
|
+
ImageBlurTask,
|
|
12001
|
+
ImageBinarySchemaOptions,
|
|
12002
|
+
ImageBinarySchema,
|
|
10750
12003
|
HumanInputTask,
|
|
10751
12004
|
HumanApprovalTask,
|
|
10752
12005
|
HUMAN_CONNECTOR,
|
|
@@ -10757,7 +12010,8 @@ export {
|
|
|
10757
12010
|
DebugLogTask,
|
|
10758
12011
|
DateFormatTask,
|
|
10759
12012
|
CredentialStoreOAuthProvider,
|
|
12013
|
+
ColorSchema,
|
|
10760
12014
|
ArrayTask
|
|
10761
12015
|
};
|
|
10762
12016
|
|
|
10763
|
-
//# debugId=
|
|
12017
|
+
//# debugId=B36303F8AC2A2F5B64756E2164756E21
|