This is a weird quirk I noticed when working through the Day 65 lesson, Basic image filtering using Core Image.
I'm testing this application on my device (iPhone 13 mini), rather than using the Simulator.
If I pass the image from the ImagePicker straight into a SwiftUI image view, the images are rotated as they appear in the photo library:
func loadImage() {
guard let inputImage = inputImage else { return }
image = Image(uiImage: inputImage)
}
However, when I pass the image from the ImagePicker into the CoreImage filter, the images are rotated...randomly? Some are sideways, some are upside down, some are right-side up. If there's a pattern, I didn't notice:
func loadImage() {
guard let inputImage = inputImage else {
return
}
let beginImage = CIImage(image: inputImage)
currentFilter.setValue(beginImage, forKey: kCIInputImageKey)
applyProcessing()
}
This doesn't happen to the images in the Simulator, but even there there's a quirk -- I cannot select the first image (the pink, purple and yellow flowers). If I click on that one, it just maintains the previously loaded image (if any).
Does anyone know why this might be happening, and if there's a workaround that forces the images back to their original rotation?