Add local background removal and mask tools

This commit is contained in:
achraf
2026-06-07 23:32:26 +02:00
parent f5364bf7a8
commit e29dc6fd6d
23 changed files with 2508 additions and 21 deletions

View File

@@ -0,0 +1,26 @@
import type { ToolInput } from "../../core/io/input-types";
import type { ToolResult } from "../../core/io/output-types";
import type { ToolContext } from "../../core/plugins/plugin-types";
import { removeImageBackground, type BackgroundRemoverOptions } from "./remove";
export async function runBackgroundRemover(
input: ToolInput,
options: BackgroundRemoverOptions,
context: ToolContext
): Promise<ToolResult> {
const files = input.files;
if (!files || !Array.isArray(files) || files.length === 0) {
throw new Error("No image provided.");
}
const file = files[0];
return removeImageBackground(
file.name,
file,
options,
self.location.origin,
context.reportProgress
);
}