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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:52:41+00:00 2026-06-10T13:52:41+00:00

In my app, user can select a pic from album or camera where i

  • 0

In my app, user can select a pic from album or camera where i can get uiimage representation. Since the album may have pic from web, the file type is not only jpg. Then i need to sent it to the server without convertion. Here i can only use nsdata.

I know UIImageJPEGRepresentation and UIImagePNGRepresentation, but i think this two method may convert the original image. Maybe when quality set to 1 UIImageJPEGRepresentation can get original pic?

Is there any method to get the original uiimage nsdata?

  • 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-10T13:52:43+00:00Added an answer on June 10, 2026 at 1:52 pm

    You can use the ALAssetsLibrary and ALAssetRepresentation to get the original data. Example:

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        NSURL *imageURL = [info objectForKey:UIImagePickerControllerReferenceURL];
        ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
        [library assetForURL:imageURL resultBlock:^(ALAsset *asset) {
            ALAssetRepresentation *repr = [asset defaultRepresentation];
            NSUInteger size = repr.size;
            NSMutableData *data = [NSMutableData dataWithLength:size];
            NSError *error;
            [repr getBytes:data.mutableBytes fromOffset:0 length:size error:&error];
                /* Now data contains the image data, if no error occurred */
        } failureBlock:^(NSError *error) {
            /* handle error */
        }];
    }
    

    But there are some things to consider:

    • assetForURL: works asynchronously.
    • On the device, using assetForURL: will cause a confirmation dialog, which might be irritating the user:

    “Your App” would like to use your current location. This allows access
    to location information in photos and videos.

    • If the user denies access, assetForURL: calls the failure block.
    • The next time you use this method, assetForURL: will fail without asking the user again. Only if you reset the location warnings in System Settings, the user is asked again.

    So you should be prepared that this method fails and use UIImageJPEGRepresentation or UIImagePNGRepresentation as a fallback. But in that case you will not get the original data, e.g. the metadata (EXIF etc.) are missing.

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

Sidebar

Related Questions

I have a requirement in which the user can select an image from camera
In my app,user can select image from gallery and after that he can zoom
In my app I have a user select a song from the library and
I have an iPhone app. The user can select a contact. Upon selection another
I have an application in which the user can select from local video files.
I'm developing web app that user can save his/her work to server. The data
In my app, a user can select an image, change the picture of a
I have a widget containing multiple child objects, which the user can select by
I'm working on an app that the user can select if he wants to
In my process, I have a page that the user can select various items

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.