{"action":"created","issue":{"url":"https://api.github.com/repos/rs/SDWebImage/issues/1317","labels_url":"https://api.github.com/repos/rs/SDWebImage/issues/1317/labels{/name}","comments_url":"https://api.github.com/repos/rs/SDWebImage/issues/1317/comments","events_url":"https://api.github.com/repos/rs/SDWebImage/issues/1317/events","html_url":"https://github.com/rs/SDWebImage/issues/1317","id":108344334,"number":1317,"title":"Image Orientation problem when loading image with SDWebImage (Swift)","user":{"login":"Farhaddc","id":10551124,"avatar_url":"https://avatars.githubusercontent.com/u/10551124?v=3","gravatar_id":"","url":"https://api.github.com/users/Farhaddc","html_url":"https://github.com/Farhaddc","followers_url":"https://api.github.com/users/Farhaddc/followers","following_url":"https://api.github.com/users/Farhaddc/following{/other_user}","gists_url":"https://api.github.com/users/Farhaddc/gists{/gist_id}","starred_url":"https://api.github.com/users/Farhaddc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Farhaddc/subscriptions","organizations_url":"https://api.github.com/users/Farhaddc/orgs","repos_url":"https://api.github.com/users/Farhaddc/repos","events_url":"https://api.github.com/users/Farhaddc/events{/privacy}","received_events_url":"https://api.github.com/users/Farhaddc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-25T15:08:41Z","updated_at":"2015-09-25T20:19:03Z","closed_at":null,"body":"When an image gets loaded with SDWebImage the orientation of my image is wrong. But when I use pure NSURL converting it to NSData and assigning to UIImage, the Image looks perfectly fine.\r\n\r\nCorrect Orientation | Wrong Orientation\r\n------------ | -------------\r\n![Correct Orientation](http://s1.postimg.org/4r9avz4fz/Wild_Bird_Correct.gif) | ![Wrong Orientation](http://s17.postimg.org/lcn5ei467/Wild_Bird_Wrong.gif)\r\n\r\n**Orientation of the photos in each scenario**\r\n* AVFoundation UIImageView Preview  (Orientation: **OK**)\r\n* On server (Orientation: **OK**)\r\n* Uploading to other Social Media (Orientation: **OK**)\r\n* In Browser  (Orientation: **OK**)\r\n* In Desktop  (Orientation: **OK**)\r\n* Loading Image to UIViewTableCell  with NSURL/NSData/UIImage  (Orientation: **OK**)\r\n```\r\n    let URLExtention = self.loadedData[indexPath.row].valueForKey(\"photoURL\") as! String\r\n    let imageURL = NSURL(string: \"https://examples.com//\\(URLExtention)\")\r\n    let imageData = NSData(contentsOfURL: imageURL!)\r\n    let Image = UIImage(data: imageData)\r\n```\r\n* Loading Image to UIViewTableCell with SDWebImage  (Orientation: **FAILED**)\r\n```\r\n cell.photo.sd_setImageWithURL(imageURL)\r\n```\r\n\r\nAlso to mention, I use [ UIImageView+AFNetworking.h](https://github.com/AFNetworking/AFNetworking/blob/master/UIKit%2BAFNetworking/UIImageView%2BAFNetworking.h) and I get **wrong orientation** as well. \r\n\r\nI would really like to use SDWebImage, cause currently I use NSCache and don't like the performance even thought it solve the issue. Please help, Thank you.\r\n\r\n## UPDATE:\r\nHere is an Image taken with AVFoundation that goes into AWS S3 Bucket. **JPEG Format**\r\n\r\n![Wrong Orientation](http://s23.postimg.org/kqvqoovpn/31348a193e9e010ec81a68203b7a8018.jpg)\r\n"},"comment":{"url":"https://api.github.com/repos/rs/SDWebImage/issues/comments/143344277","html_url":"https://github.com/rs/SDWebImage/issues/1317#issuecomment-143344277","issue_url":"https://api.github.com/repos/rs/SDWebImage/issues/1317","id":143344277,"user":{"login":"mythodeia","id":1748458,"avatar_url":"https://avatars.githubusercontent.com/u/1748458?v=3","gravatar_id":"","url":"https://api.github.com/users/mythodeia","html_url":"https://github.com/mythodeia","followers_url":"https://api.github.com/users/mythodeia/followers","following_url":"https://api.github.com/users/mythodeia/following{/other_user}","gists_url":"https://api.github.com/users/mythodeia/gists{/gist_id}","starred_url":"https://api.github.com/users/mythodeia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythodeia/subscriptions","organizations_url":"https://api.github.com/users/mythodeia/orgs","repos_url":"https://api.github.com/users/mythodeia/repos","events_url":"https://api.github.com/users/mythodeia/events{/privacy}","received_events_url":"https://api.github.com/users/mythodeia/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T20:19:03Z","updated_at":"2015-09-25T20:19:03Z","body":"@Farhaddc this specific image has no exif metadata for orientation. I tried several online tools as well and no orientation key exists inside the EXIF metadata.\r\nSo SDWebImage in this method ```sd_imageOrientationFromImageData``` when it tries to get the orientation it returns ```UIImageOrientationUp``` which is the default one as no ```kCGImagePropertyOrientation``` is found inside the image. So there is no way to know which way is up"}}