itouch2 / PhotoTweaks

Drag, Rotate, Scale and Crop
MIT License
1.26k stars 168 forks source link

Hello when I try saving metadata to an image the UIImageOrientation will be flipped? #11

Closed jrr363 closed 9 years ago

jrr363 commented 9 years ago

you have any ideas on why? Great project by the way love the simplicity!

itouch2 commented 9 years ago

I think you should check the image orientation of image, and rotate it according to the image orientation, then to save it. For example, if the image orientation of an image is UIImageOrientationDown, then it should be rotated by M_PI.

jrr363 commented 9 years ago

Yup yup you were definitely correct. Thank you! Below: I changed your 'saveBtnTapped' method a little to give the user the option to save with or without metadata.

itouch2 commented 9 years ago

Hi, I just add the api

[library writeImageToSavedPhotosAlbum:image.CGImage orientation:(ALAssetOrientation)image.imageOrientation completionBlock:^(NSURL *assetURL, NSError *error) {
    if (!error) {
    }
}];

to save the orientation of the image