struct ContentView: View {
var processed: CIImage {
let filter = CIFilter.differenceBlendMode()
filter.inputImage = UIImage(resource: .image).cgImage.map({CIImage(cgImage: $0)})
filter.backgroundImage = UIImage(resource: .whiteBg).cgImage.map({CIImage(cgImage: $0)})
return filter.outputImage!
}
var body: some View {
VStack(spacing: 0) {
Image(ciImage: processed)
.resizable()
.scaledToFit()
Image(.image)
.resizable()
.scaledToFit()
.blendMode(.difference)
}
}
}
This produces two different Images.
What's missing from the filter?
It's a problem with colorspace
Fixed it