I’m having problems getting my images on my ios app to have the correct orientation. EXIF for the orientation = 6 but I can’t get it to autorotate. I’m using MBS, the messagebox says it’s rotated but its not…If orientation = 1 I’m not having any issues because these don’t need rotating.
Dim ciImage As New CIImageMBS(file)
Dim properties As Dictionary = ciImage.Properties
If properties.HasKey("Orientation") Then
Dim orientation As Integer = properties.Value("Orientation")
MEssageBox("EXIF Orientation: " + orientation.ToString)
If orientation = 6 Then // Rotate 90° CW
var transform as new NSAffineTransformMBS
transform.rotateByDegrees(270)
// Use filter
var f as new CIFilterAffineTransformMBS
f.inputImage = ciImage
f.inputTransform = transform
Dim rotated As CIImageMBS = f.OutputImage
// Create output
Dim context As New CIContextMBS
Dim extent As CGRectMBS = rotated.Extent
Dim cgPic As CGImageMBS = context.createCGImage(rotated, extent)
If cgPic <> Nil Then
p = cgPic.Picture
MEssageBox("Returning rotated picture: " + p.Width.ToString + " x " + p.Height.ToString)
Else
MEssageBox("CGImageMBS was NIL!")
End If