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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:14:08+00:00 2026-06-06T22:14:08+00:00

I make a picture with phone (640*480) and put it inside uiimageview (300*300) with

  • 0

I make a picture with phone (640*480) and put it inside uiimageview (300*300) with scale to fill options set.
I need to send the same image that is displayed inside uiimageview (300*300, croped, resized) to server….

How can i get it?

  • 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-06T22:14:09+00:00Added an answer on June 6, 2026 at 10:14 pm

    There is a quick a dirty way to do this, by rendering the UIImageView layer to a graphics context.

    UIGraphicsBeginImageContext(self.bounds.size);
    [self.imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    

    you will need to import <QuartzCore/QuartzCore.h> for this.

    The other way would be to do the calculations for AspectFill your self.

     CGSize finalImageSize = CGSizeMake(300,300);
     CGImageRef sourceImageRef = yourImage.CGImage;
    
    CGFloat horizontalRatio = finalImageSize.width / CGImageGetWidth(sourceImageRef);
    CGFloat verticalRatio = finalImageSize.height / CGImageGetHeight(sourceImageRef);
    CGFloat ratio = MAX(horizontalRatio, verticalRatio); //AspectFill
    CGSize aspectFillSize = CGSizeMake(CGImageGetWidth(sourceImageRef) * ratio, CGImageGetHeight(sourceImageRef) * ratio);
    
    
    CGContextRef context = CGBitmapContextCreate(NULL,
                                                 finalImageSize.width,
                                                 finalImageSize.height,
                                                 CGImageGetBitsPerComponent(sourceImageRef),
                                                 0,
                                                 CGImageGetColorSpace(sourceImageRef),
                                                 CGImageGetBitmapInfo(sourceImageRef));
    
    //Draw our image centered vertically and horizontally in our context.
    CGContextDrawImage(context, 
                       CGRectMake((finalImageSize.width-aspectFillSize.width)/2,
                                  (finalImageSize.height-aspectFillSize.height)/2,
                                  aspectFillSize.width,
                                  aspectFillSize.height),
                       sourceImageRef);
    
    //Start cleaning up..
    CGImageRelease(sourceImageRef);
    
    CGImageRef finalImageRef = CGBitmapContextCreateImage(context);
    UIImage *finalImage = [UIImage imageWithCGImage:finalImageRef];
    
    CGContextRelease(context);
    CGImageRelease(finalImageRef);
    return finalImage;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a picture over picture fading with some text appearing on
I would like to make a button with large hover picture on top of
I am trying to make an animated clock using Swing in Java. The picture
I want to display a picture near a LinearLayout . I want to make
How to make picture in a Canvas onTouch, like a button. Just to be
If I make a picture with mine samsung galaxy s2, the picture is 3264
I want to make a picture gallery with a vertical layout with two parts:
I would like to make the following layout, see picture below, where the place
I have an application that allows the user to send a picture. This picture
In my WP7 application I need to the user to take a picture before

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.