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 8614531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:08:33+00:00 2026-06-12T05:08:33+00:00

I can crop images from the iPhone’s photo library no problem like this: CGRect

  • 0

I can crop images from the iPhone’s photo library no problem like this:

CGRect topRect = CGRectMake(0, 0, image.size.width, image.size.height / 2);
CGImageRef topCroppedCGImageRef = CGImageCreateWithImageInRect(image.CGImage, 
                                                               topRect);
UIImage *croppedImage = [[UIImage alloc] initWithCGImage:topCroppedCGImageRef];
CGImageRelease(topCroppedCGImageRef);

However this doesn’t work when the image comes from the camera. Specifically the cropped image is rotated and the cropped portion isn’t as expected. After reading around it sounds like this problem is relatively common. However I’ve tried the various code fixes and it’s not quite working (still have rotation, unexpected cropping and even distortion issues). So I’d like to actually understand why the above cropping doesn’t just work for images coming from the camera.

Why doesn’t the above cropping method work on images coming from the iPhone’s camera?

  • 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. Editorial Team
    Editorial Team
    2026-06-12T05:08:34+00:00Added an answer on June 12, 2026 at 5:08 am

    As pointed out by this famous post – Resize a UIImage the right way, this is because you leave out functionality such as EXIF orientation support, an absolute necessity when dealing with photographs taken by the iPhone’s camera.

    By default (picture taken in portrait) the image has an EXIF orientation flag = 6 which means the image is rotated 90 degrees counterclockwise:

    $ identify -format "%[EXIF:orientation]" myimage.jpg 
    6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have had this problem crop up a few times and I can't figure
How can I resize, scale and crop images coming from url before caching them.
Having until now only used PHP's gd image library to resize, crop and greyscale
In My iPhone application,I want to crop an image.That means i want to select
I would like to crop images on upload using Paperclip to get square thumbs
I have an image .I want to crop 10 px from left and 10px
I am trying to crop images selected from Gallery and the Camera . I
I'm facing a problem with parsing a uri of taken photo to crop activity.
I have some strange problem with PIL not resizing the image. from PIL import
This image best illustrates the problem: I'm customizing a WordPress theme that uses SuperBGImage.

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.