UNPKG

@thi.ng/imago

Version:

JSON & API-based declarative and extensible image processing trees/pipelines

29 lines (28 loc) 468 B
import { positionOrGravity } from "../utils.js"; const rawLayerImpl = async (layer, _, ctx) => { const { type: __, buffer, channels, gravity, pos, ref, size, unit, ...opts } = layer; const $pos = positionOrGravity(size, ctx.size, layer); return { input: Buffer.from(buffer.buffer), raw: { width: size[0], height: size[1], channels }, ...$pos, ...opts }; }; export { rawLayerImpl };