Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Marcos Reboucas
12,890 PointsImages being rotated after converting to CIImage. How to fix?
I'm running the app on actual iPhone instead of simulator so I can take pics. The only orientation that works fine when taking a pic is landscape left. If I take a pic with iPhone in any other orientation (landscape right, portrait or upside down) the image is rotated when converted to CIImage and show up rotated in the collection view with effects. I know the problem is in the conversion (UIImage -> CIImage) because the image passed in this function is in always in the correct resolution:
func image(image: UIImage, withFilter filter: CIFilter) -> CIImage
However the resolution changes after the conversion:
let inputImage = image.CIImage ?? CIImage(image: image)!
Any idea on how to solve this? I've tried to change CIImage orientation after create it and also searched for some initializer that takes an orientation as parameter.
1 Answer
Marcos Reboucas
12,890 PointsHey Patrick Montalbano in the last video of this course Pasan Premaratne comment about this problem, suggesting a solution that would be crop the images so they will all have the same orientation. Hope it helps!
Patrick Montalbano
494 PointsPatrick Montalbano
494 PointsI'm running into the same problem myself...any luck?