IPhone/Xcode: UIImage and UIImageView won't get with the program?

Ok. I figured it out. Apparently when you save things with PNG representation, and not JPEG representation, the image orientation information is not saved with it.

Because of this, every image loaded will default to showing orientation up. So, the easiest way is to do this.

Ok. I figured it out. Apparently when you save things with PNG representation, and not JPEG representation, the image orientation information is not saved with it.

Because of this, every image loaded will default to showing orientation up. So, the easiest way is to do this: NSData* data = UIImageJPEGRepresentation(image,0.0); data writeToFile:path atomically:YES; instead of this: UIImagePNGRepresentation(image) writeToFile:path atomically:YES; And, of course, changing all the picture names from . Png to .jpg.

The 0.0 part of the code above is to control Alpha levels, which is required of jpegs. Hope this helps people in the future!

I assume you're using the Assets Library Framework to get the image. If so, you'll want to get the orientation of the image in your results block, and manipulate the UIImage to adjust. I have something like the following: ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset* asset) { ALAssetRepresentation* rep = asset defaultRepresentation; _orientation = rep.

Orientation; ... } Aside: What a great type name, huh? Holy moly, does Objective-C need namespaces!

Hmm, I may have to try that. But, I am not using the Assets Library. Look at my EDIT to get some more info on what I've done.

Sorry for the confusion. – Nathan Wright Feb 9 '11 at 4:07.

This is answered in a similar question here.

That would work, except for some odd reason, the image always says it's oriented up, even when it obviously isn't! It only rotates after ALL of the code has been run. I've tried doing a force redraw in between my code to see if that changes things, but it doesn't.It's the weirdest thing... – Nathan Wright Feb 9 '11 at 3:54.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions