Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This happens because the orientation set in the metadata of the new image is being effected by the orientation of the AV system that creates it. The layout of the actual image data is of course different from the orientation mentioned in your metadata. Some image viewing programs respect the metadata orientation, some ignore it.</p> <p>You can affect the metadata orientation of the AV system by calling:</p> <pre><code>AVCaptureConnection *videoConnection = ...; if ([videoConnection isVideoOrientationSupported]) [videoConnection setVideoOrientation:AVCaptureVideoOrientationSomething]; </code></pre> <p>You can affect the metadata orientation of a UIImage by calling:</p> <pre><code>UIImage *rotatedImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:1.0f orientation:UIImageOrientationSomething]; </code></pre> <p>But the actual data from the AVCapture system will always appear with the wider dimension as X and the narrower dimension as Y, and will appear to be oriented in LandscapeLeft.</p> <p>If you want the actual data to line up with what your metadata claims, you need to modify the actual data. You can do this by writing the image out to a new image using CGContexts and AffineTransforms. Or there is an easier workaround, use the UIImage+Resize package as discussed <a href="http://smallduck.wordpress.com/2010/01/14/improvement-to-uiimageplusresize-m/" rel="noreferrer">here</a>. And resize the image to it's current size by calling:</p> <pre><code>UIImage *rotatedImage = [image resizedImage:CGSizeMake(image.size.width, image.size.height) interpolationQuality:kCGInterpolationDefault]; </code></pre> <p>This will rectify the data's orientation as a side effect.</p> <p>If you don't want to include the whole UIImage+Resize thing you can checkout it's code and strip out the parts where the data is transformed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload