 @inlinable
 @inline(__always)
 public func BilateralFilter<Pixel>(_ texture: Texture<Pixel>, _ spatial: Double, _ range: Double) -> Texture<Pixel> {
-    
-    precondition(spatial > 0, "spatial is less than or equal to zero.")
+    return BilateralFilter(texture, Size(width: spatial, height: spatial), range)
+}
+
+@inlinable
+@inline(__always)
+public func BilateralFilter<Pixel>(_ image: Image<Pixel>, _ spatial: Size, _ range: Double) -> Image<Pixel> {
+    return Image(texture: BilateralFilter(Texture(image: image), spatial, range), resolution: image.resolution, colorSpace: image.colorSpace)
+}
+
+@inlinable
+@inline(__always)
+public func BilateralFilter<Pixel>(_ texture: Texture<Pixel>, _ spatial: Size, _ range: Double) -> Texture<Pixel> {
+    
+    precondition(spatial.width > 0 || spatial.height > 0, "spatial is less than or equal to zero.")
     precondition(range > 0, "range is less than or equal to zero.")
     
     @inline(__always)

@inlinable
@inline(__always)
public func BilateralFilter<Pixel : _FloatComponentPixel>(_ texture: Texture<Pixel>, _ spatial: Pixel.Scalar, _ range: Pixel.Scalar) -> Texture<Pixel> where Pixel.Scalar : FloatingMathProtocol {
    
    precondition(spatial > 0, "spatial is less than or equal to zero.")
    precondition(range > 0, "range is less than or equal to zero.")
    
    @inline(__always)

        return d._color.reduce(d._opacity * d._opacity) { $0 + $1 * $1 }
    }
    
    let _r0 = Int(ceil(6 * spatial.width)) >> 1
    let _r1 = Int(ceil(6 * spatial.height)) >> 1
    
    var result = texture
    
    let width = texture.width
    let height = texture.height
    
    let _c0 = -0.5 / Pixel.Scalar(spatial.width * spatial.width)
    let _c1 = -0.5 / Pixel.Scalar(spatial.height * spatial.height)
    let _c2 = -0.5 / Pixel.Scalar(range * range)
    
    result.withUnsafeMutableBufferPointer {
        
