func getImageWithFilter(by filterType: MainViewModel.FilterType,
image: CIImage) -> CIImage {
guard filterType.filterEnabled,
let filter = CIFilter(name: filterType.rawValue)
else {
return image
}
filter.setValue(image, forKey: kCIInputImageKey)
return filter.outputImage ?? image
}
I have two output:
- AVCaptureVideoDataOutput for preview
- AVCapturePhotoOutput for save photo in hightResolution.
After applied filters i get different results
Help me please resolve this problem.


This happens because most parameters of built-in Core Image filters operate on a pixel basis. In your case it's the
inputRadiusparameter of theCICrystallizefilter. From the docs:That means that you need to set the parameter to different values depending on the input size.
I usually calculate some kind of factor that I multiply with my base parameter value. For instance: