sujith1406
sujith1406

Reputation: 2822

orientation of image in imageview is shifted 90 left in device

i am selecting image from imagepickercontroller and diplaying in an imageview.however for images taken from the camera ,they always appear 90 left in the device.for the images i take in the simulator they have the correct orientation.how to correct this.should i specify any orientation for images

Upvotes: 0

Views: 704

Answers (2)

user3673300
user3673300

Reputation: 1

I had the same issue but finally I solved it with the following code:

UIImage*Image=[UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]];

Upvotes: 0

Brenton Morse
Brenton Morse

Reputation: 2567

I ran into the same issue myself. The way I solved it was to check the images orientation and then rotate it if it was supposed to be landscape.

The code I used was:

float orientation = [[myPhotoAsset valueForProperty:@"ALAssetPropertyOrientation"] floatValue];

if (orientation == 3)
    photo = [self CGImageRotatedByAngle:photo angle:-90];

Cheers

Upvotes: 1

Related Questions