     
     public var inputImage: MTIImage?
     
+    public var outputImageSize: CGSize?
+    
     public var outputImage: MTIImage? {
         guard let inputImage = self.inputImage, let filter = filter?.copy() as? CIFilter else {
             return nil
         }
-        let placeholder = CIImage(color: CIColor()).cropped(to: inputImage.extent)
-        filter.setValue(placeholder, forKey: kCIInputImageKey)
         let dimensions: MTITextureDimensions
-        if let output = filter.outputImage {
-            dimensions = MTITextureDimensions(cgSize: output.extent.size)
+        if let outputImageSize = self.outputImageSize {
+            dimensions = MTITextureDimensions(cgSize: outputImageSize)
         } else {
-            assertionFailure()
-            dimensions = inputImage.dimensions
+            let placeholder = CIImage(color: CIColor()).cropped(to: inputImage.extent)
+            filter.setValue(placeholder, forKey: kCIInputImageKey)
+            if let output = filter.outputImage {
+                dimensions = MTITextureDimensions(cgSize: output.extent.size)
+            } else {
+                assertionFailure()
+                dimensions = inputImage.dimensions
+            }
         }
         return MTICoreImageKernel.image(byProcessing: inputImage, using: filter, colorSpace: colorSpace, outputDimensions: dimensions, outputPixelFormat: outputPixelFormat, outputAlphaType: .nonPremultiplied)
     }

    
    public enum Error: Swift.Error {
        case failedToCreateCIImage
        case outputDimensionsMismatch
        case nilOutput
    }
    

            return self
        }
        
        private func ciImage(for mtiImage: MTIImage, from texture: MTLTexture) throws -> CIImage {
            let options: [CIImageOption: Any] = [.colorSpace: colorSpace ?? NSNull()]
            if let image = CIImage(mtlTexture: texture, options: options) {
                if mtiImage.alphaType == .nonPremultiplied {
                    return image.premultiplyingAlpha().oriented(.downMirrored)
                } else {
                    return image.oriented(.downMirrored)
                }
            } else {
                throw Error.failedToCreateCIImage
            }
        }
        
        func resolve(with renderingContext: MTIImageRenderingContext) throws -> MTIImagePromiseRenderTarget {
            let inputCIImages: [CIImage] = try dependencies.map({
                let texture = renderingContext.resolvedTexture(for: $0)
                // CoreImage does not support yCbCr8_420_2p, yCbCr8_420_2p_srgb pixel format. We have to convert.
                if texture.pixelFormat == .yCbCr8_420_2p || texture.pixelFormat == .yCbCr8_420_2p_srgb {
                    let textureDescriptor = MTLTextureDescriptor.texture2DDescriptor(pixelFormat: .bgra8Unorm, width: texture.width, height: texture.height, mipmapped: false)
