File size: 933 Bytes
3144483 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { createRastermill, type ImageExecutionMode } from "rastermill";
import { resolveSystemBin } from "../infra/resolve-system-bin.js";
import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";
/** Shared input/output pixel cap for Rastermill-backed image operations. */
export const MAX_IMAGE_INPUT_PIXELS = 25_000_000;
export type ImageProcessorPixelLimits = { inputPixels: number; outputPixels: number };
export function createLocalImageProcessor(
execution: ImageExecutionMode,
limits: ImageProcessorPixelLimits = {
inputPixels: MAX_IMAGE_INPUT_PIXELS,
outputPixels: MAX_IMAGE_INPUT_PIXELS,
},
) {
return createRastermill({
execution,
limits,
temp: {
rootDir: resolvePreferredOpenClawTmpDir(),
prefix: "openclaw-img-",
},
commandResolver: (command) =>
resolveSystemBin(command, { trust: command === "powershell" ? "strict" : "standard" }),
});
}
|