image-js
Version:
Image processing and manipulation in JavaScript
15 lines • 564 B
JavaScript
import { maskToOutputMask } from '../utils/getOutputImage.js';
/**
* Fill holes in regions of interest.
* @param mask - Mask to process.
* @param options - Flood fill options.
* @returns The filled mask.
*/
export function solidFill(mask, options = {}) {
const { allowCorners = false } = options;
const newImage = maskToOutputMask(mask, options, { clone: true });
const inverted = mask.invert();
const cleared = inverted.clearBorder({ allowCorners });
return newImage.or(cleared, { out: newImage });
}
//# sourceMappingURL=solidFill.js.map