static Image2B binaryImageOutline(IImage2B image) { int w = image.w(), h = image.h(); ret image == null ?: binaryImageFromFunction(w+2, h+2, (x, y) -> getBoolPixelDefaultTrue(image, x+1, y+1) && !getBoolPixelDefaultTrue(image, x-1, y-1) && !getBoolPixelDefaultTrue(image, x, y-1) && !getBoolPixelDefaultTrue(image, x+1, y-1) && !getBoolPixelDefaultTrue(image, x-1, y) && !getBoolPixelDefaultTrue(image, x+1, y) && !getBoolPixelDefaultTrue(image, x-1, y+1) && !getBoolPixelDefaultTrue(image, x, y+1) && !getBoolPixelDefaultTrue(image, x+1, y+1)); }