Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to save photo with EXIF(GPS) AND orientation on iPhone?
    primarykey
    data
    text
    <p>I'm using <a href="http://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html#//apple_ref/occ/instm/ALAssetsLibrary/writeImageToSavedPhotosAlbum:metadata:completionBlock:" rel="noreferrer">writeImageToSavedPhotosAlbum:metadata:completionBlock:</a> to save images to the camera roll (GPS data is in dictionary passed to metadata). However pictures are misoriented (as I flip the device while taking the pictures). </p> <p>There's another function writeImageToSavedPhotosAlbum:orientation:completionBlock: but I won't be able to pass EXIF data.</p> <p>According to the documentation, there's <a href="http://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGImageProperties_Reference/Reference/reference.html#//apple_ref/doc/c_ref/kCGImagePropertyOrientation" rel="noreferrer">kCGImagePropertyOrientation</a> property to set orientation manually but I'm having problems with detecting current orientation of the device while taking the picture and saving it.</p> <p>Has anyone achieved saving picture with EXIF data and proper orientation? Any help would be very appreciated.</p> <p>Here's my code:</p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; [self dismissModalViewControllerAnimated:YES]; [imageView setImage:image]; if(sourceCamera) { //EXIF and GPS metadata dictionary (...) //saving image ALAssetsLibrary *al = [[ALAssetsLibrary alloc] init]; [al writeImageToSavedPhotosAlbum:[image CGImage] metadata:dict completionBlock:^(NSURL *assetURL, NSError *error) { if (error == nil) { NSLog(@"saved"); } else { NSLog(@"error"); } }]; [al release]; } } </code></pre> <p>Best wishes,</p> <p>a.</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. 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