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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:32:17+00:00 2026-05-16T22:32:17+00:00

I am attempting to take an image captured from the rear camera, apply a

  • 0

I am attempting to take an image captured from the rear camera, apply a scaling transformation to it and then output a new image with the same size of the original but scaled up.

What I have below works … BUT it is slow (especially the code in between the UIGraphicsBeginImageContext(size); and UIGraphicsEndImageContext();)

Is there a better way of doing this? In particular, a way that will produce the same result but faster?

UIImage *tempImage = [[UIImage alloc] initWithData:imageData];

CGImageRef img = [tempImage CGImage];
CGFloat width = CGImageGetWidth(img);
CGFloat height = CGImageGetHeight(img);
CGRect bounds = CGRectMake(0, 0, width, height);
CGSize size = bounds.size;

CGFloat z = 5.0; 
CGAffineTransform xfrm = CGAffineTransformMakeScale(z, z);

UIGraphicsBeginImageContext(size);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextConcatCTM(currentContext, xfrm);
CGContextDrawImage(currentContext, bounds, img);

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

Thanks – wg

  • 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-05-16T22:32:18+00:00Added an answer on May 16, 2026 at 10:32 pm

    The answer is simple: Crop and then scale

    The size of a UIImage can be considerable especially when captured via the camera in “photo” quality resulting in poor performance when scaling it up. So, best practice is to first crop the photo to the needed size AND then scale as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to take large (huge) images (from a digital camera), and convert them
Using PHP I'm attempting to take an HTML string passed from a WYSIWYG editor
I'm attempting to create a page that displays and refreshes an image from a
I am attempting to update the div of my dialog with new content from
I attempting to take a response from a REST service that queries an instance
i am attempting to take the value of a textfield and make apply it
I am attempting to launch the built-in camera to take a picture, a picture
I'm attempting to take values from a XML file and put them into a
I am attempting to take the Name and ID fields from each object, but
I'm attempting to put together a makefile that will take source files from a

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.