title: How do I make an exact copy of a UIImage returned from a UIImagePickerController?
body: <p>I have divergent needs for the image returned from the iPhone camera. My app scales the image down for upload and display and, recently, I added the ability to save the image to the Photos app.</p>
  
  <p>At first I was assigning the returned value to two separate variables, but it turned out that they were sharing the same object, so I was getting two scaled-down images instead of having one at full scale.</p>
  
  <p>After figuring out that you can't do <code>UIImage *copyImage = [myImage copy];</code>, I made a copy using <em>imageWithCGImage</em>, per below. Unfortunately, this doesn't work because the copy (here <em>croppedImage</em>) ends up rotated 90º from the original.</p>
  
  <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
  {   
      // Resize, crop, and correct orientation issues
      self.originalImage = [info valueForKey:@"UIImagePickerControllerOriginalImage"];
      UIImageWriteToSavedPhotosAlbum(originalImage, nil, nil, nil);
      UIImage *smallImage = [UIImage imageWithCGImage:[originalImage CGImage]]; // UIImage doesn't conform to NSCopy
  
      // This method is from a category on UIImage based on this discussion:
      // http://discussions.apple.com/message.jspa?messageID=7276709
      // It doesn't rotate smallImage, though: while imageWithCGImage returns
      // a rotated CGImage, the UIImageOrientation remains at UIImageOrientationUp!
      UIImage *fixedImage = [smallImage scaleAndRotateImageFromImagePickerWithLongestSide:480];
      ...
  }
  </code></pre>
  
  <p>Is there a way to copy the UIImagePickerControllerOriginalImage image without modifying it in the process?</p>