@thi.ng/imago
Version:
JSON & API-based declarative and extensible image processing trees/pipelines
21 lines (20 loc) • 460 B
JavaScript
import { coerceColor, computeMargins } from "../utils.js";
const extendProc = async (spec, input, ctx) => {
const { bg, border, mode, ref, unit } = spec;
const sides = computeMargins(border, ctx.size, ref, unit);
const [left, right, top, bottom] = sides;
return [
input.extend({
left,
right,
top,
bottom,
background: coerceColor(bg || "#0000"),
extendWith: mode
}),
true
];
};
export {
extendProc
};