Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 177611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:05:06+00:00 2026-05-11T14:05:06+00:00

Update: With iPhone OS 3.0+, the whole UIImagePickerController API has changed. This question and

  • 0

Update:

With iPhone OS 3.0+, the whole UIImagePickerController API has changed. This question and answer should be considered 2.2. legacy code.


When using the UIImagePickerController and you allow editing of the image. The iPhone allows the user to resize and pan the image. However, the max size of an edited image is capped at 320×320.

As an example, I took an iPhone screenshot and placed it in the photo library, which is a 480×320 png. When I use a UIImagePickerController to select that image, even if I do NOT scale or pan the image, it is cropped to 320×320 before it is returned from the UIImagePickerController. However, if I turn editing off, the image is returned the proper 480×320 size.

My theory: Very subtly, the iPhone displays 2 nonstandard translucent tool bars that overlay over the image. These toolbars leave an innocuous 320×320 ‘window’ over the photo. It appears to me that this window effectively clips the underlying photo.

Note: The callback also returns an editing dictionary with the original image and the clipping rect, but of course the rect is also max 320×320.

Any ideas on how to allow images larger than 320×320 to be scaled and panned?

Some code:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {          self.myImageView.userInteractionEnabled=YES;         CGRect imageFrame = myImageView.frame;         CGPoint imageCenter = myImageView.center;         imageFrame.size = img.size;         myImageView.frame = imageFrame;         self.myImageView.image = img;         myImageView.center = imageCenter;          [self dismissModalViewControllerAnimated:YES];         [self performSelector:@selector(hideToolBars) withObject:nil afterDelay:2.0];     } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:05:06+00:00Added an answer on May 11, 2026 at 2:05 pm

    As craig said, this is an issue in the dev forums and apples regular discussion board. I did, however, find a way around it. I’m using a bit of code from:

    Apple Dev Forums

    This includes most of what you need, and takes care of all the camera orientation issues. I’ve added the following which will take in the editing info and use it to get the original cropping rect with this addition:

    - (UIImage*)scaleImage:(UIImage*)anImage withEditingInfo:(NSDictionary*)editInfo{      UIImage *newImage;      UIImage *originalImage = [editInfo valueForKey:@'UIImagePickerControllerOriginalImage'];     CGSize originalSize = CGSizeMake(originalImage.size.width, originalImage.size.height);     CGRect originalFrame;     originalFrame.origin = CGPointMake(0,0);     originalFrame.size = originalSize;      CGRect croppingRect = [[editInfo valueForKey:@'UIImagePickerControllerCropRect'] CGRectValue];     CGSize croppingRectSize = CGSizeMake(croppingRect.size.width, croppingRect.size.height);      CGSize croppedScaledImageSize = anImage.size;      float scaledBarClipHeight = 80;      CGSize scaledImageSize;     float scale;      if(!CGSizeEqualToSize(croppedScaledImageSize, originalSize)){          scale = croppedScaledImageSize.width/croppingRectSize.width;         float barClipHeight = scaledBarClipHeight/scale;          croppingRect.origin.y -= barClipHeight;         croppingRect.size.height += (2*barClipHeight);          if(croppingRect.origin.y<=0){             croppingRect.size.height += croppingRect.origin.y;             croppingRect.origin.y=0;         }          if(croppingRect.size.height > (originalSize.height - croppingRect.origin.y)){             croppingRect.size.height = (originalSize.height - croppingRect.origin.y);         }           scaledImageSize = croppingRect.size;         scaledImageSize.width *= scale;         scaledImageSize.height *= scale;          newImage =  [self cropImage:originalImage to:croppingRect andScaleTo:scaledImageSize];      }else{          newImage = originalImage;      }      return newImage; } 

    I updated the call back method from the dev forums post to the following:

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {      [self dismissModalViewControllerAnimated:YES];     self.myImageView.userInteractionEnabled=YES;     CGRect imageFrame = myImageView.frame;     CGPoint imageCenter = myImageView.center;     UIImage *croppedImage;       NSMutableDictionary *imageDescriptor = [editInfo mutableCopy];      // CGFloat scaleSize = 400.0f;     CGFloat scaleSize = 640.0f;     switch ([picker sourceType]) {             //done         case UIImagePickerControllerSourceTypePhotoLibrary:             croppedImage = [self scaleImage:img withEditingInfo:editInfo];             [imageDescriptor setObject:croppedImage forKey:@'croppedImage'];             break;           case UIImagePickerControllerSourceTypeCamera: {             UIImageOrientation originalOrientation = [[editInfo objectForKey:UIImagePickerControllerOriginalImage] imageOrientation];             if (originalOrientation != UIImageOrientationUp) {                 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];                 CGRect origRect;                 [[editInfo objectForKey:UIImagePickerControllerCropRect] getValue:&origRect];                 UIImage *rotatedImage = straightenAndScaleImage([editInfo objectForKey:UIImagePickerControllerOriginalImage], scaleSize);                 CGFloat scale = scaleSize/1600.0f;                 origRect.origin.x *= scale;                 origRect.origin.y *= scale;                 origRect.size.width *= scale;                 origRect.size.height *= scale;                 croppedImage = [self cropImage:rotatedImage to:origRect andScaleTo:CGSizeMake(320, 480)];                 [imageDescriptor setObject:croppedImage forKey:@'croppedImage'];                 [pool drain];             }             else {                 croppedImage = [self scaleImage:img withEditingInfo:editInfo];                 [imageDescriptor setObject:croppedImage forKey:@'croppedImage'];             }         }             break;          case UIImagePickerControllerSourceTypeSavedPhotosAlbum: {             UIImageOrientation originalOrientation = [[editInfo objectForKey:UIImagePickerControllerOriginalImage] imageOrientation];             if (originalOrientation != UIImageOrientationUp) {                 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];                 CGRect origRect;                 [[editInfo objectForKey:UIImagePickerControllerCropRect] getValue:&origRect];                 UIImage *rotatedImage = straightenAndScaleImage([editInfo objectForKey:UIImagePickerControllerOriginalImage], scaleSize);                 CGFloat scale = scaleSize/640.0f;                 origRect.origin.x *= scale;                 origRect.origin.y *= scale;                 origRect.size.width *= scale;                 origRect.size.height *= scale;                 croppedImage = [self cropImage:rotatedImage to:origRect andScaleTo:CGSizeMake(320, 480)];                 [imageDescriptor setObject:croppedImage forKey:@'croppedImage'];                 [pool drain];             }             else {                 croppedImage = [self scaleImage:img withEditingInfo:editInfo];                 [imageDescriptor setObject:croppedImage forKey:@'croppedImage'];             }         }             break;         default:             break;     }      imageFrame.size = croppedImage.size;     myImageView.frame = imageFrame;     myImageView.image = [imageDescriptor objectForKey:@'croppedImage'];     myImageView.center = imageCenter;   } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If it helps, apple events are sent on port 3031… May 12, 2026 at 12:52 am
  • Editorial Team
    Editorial Team added an answer You could add two generic constraints; I don't know how… May 12, 2026 at 12:52 am
  • Editorial Team
    Editorial Team added an answer I only use DI on the Constructor if I need… May 12, 2026 at 12:52 am

Related Questions

I am currently working with a device that has iPhone OS 2.2.1. And as
I'd like to use some features of iPhone OS 3.0 in my 2.0 app
I am trying to update my iPhone app to work with OS 3.0. I
A manager asked me to do some quick research on the possibility of doing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.