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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:43:32+00:00 2026-05-12T09:43:32+00:00

I have an application, in which User selects an images from iPhone, for photo

  • 0

I have an application,
in which

User selects an images from iPhone, for photo field,

Image is uploaded to the server,

Image size may be of 1 kb, or 10 kb or it may be 1 mb or 10 mb.

If image size is more than 5mb than image must be downsized upto 5mb before storing to the server.Question is How?is it Possible?

i have used following code for downloading image – for compressing image while loading,
imageDatafromPhoto = UIImageJPEGRepresentation([info objectForKey:@”UIImagePickerControllerOriginalImage”],0.2);

Thanks for helping me.

  • 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-12T09:43:32+00:00Added an answer on May 12, 2026 at 9:43 am

    There’s a difference between ‘compressing’ and ‘resampling’. Compression is a lossless way of making a document smaller, such as GZip. Although there aren’t any standard interfaces in Objective-C to help you do this, there’s a few extensions for NSData as a category that you can use to add GZip compression.

    However, that in itself won’t help you. JPEG images tend not to compress well, so what you really want is resampling or adjustment of the image itself. This throws some data away, making it smaller but also worse quality. This is the purpose of the 0.2 at the end of it – 0.0 is the maximal compression that you can get out of the library. You could try calling it with ever successively small numbers (say, in a for loop) until you get an image size that is of acceptable quality.

    Failing that, you would have to do a resize by drawing the image into a CGContextDrawImage with a specified size into a CG buffer (from CGBitmapContextCreate) and then get the new image from the result drawn in there, and start again.

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

Sidebar

Related Questions

I have an application, in which the user will select an image from a
I have a web application in which a user has to upload images to
i have created an application which show data from user current location. I want
I have an application in which I want to authenticate a user from a
I have a client application which runs as a Java applet from a user's
I have an application in which the user can select from local video files.
I have an Android application which retrieves from a external server, a name and
I have a simple application in which I need to let the user select
I have an application in which I have to show the alerts for user
I have been working on an application which allows the user to make 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.