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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:28:11+00:00 2026-06-18T09:28:11+00:00

With this code below, I can extract metadata from an image (pre-added to my

  • 0

With this code below, I can extract metadata from an image (pre-added to my project), and render the info as text. This is exactly what I want to do. The SYMetadata is created by pointing to an image via URL. initWithAbsolutePathURL. I want to do the same thing with a UIImage or maybe the image that is being loaded to the UIImage. How do I get the URL to the image that the picker selects? Or how do I create an “asset” from this incoming image?

The documentation describes initWithAsset. Have not figured out how to use it yet though, or if this is the right way to go for my purpose. Any help greatly appreciated.

NSURL *imageURL = [[NSBundle mainBundle] URLForResource:@"someImage" withExtension:@"jpg"];
SYMetadata *metadata = [[SYMetadata alloc] initWithAbsolutePathURL:imageURL];
[textView setText:[[metadata allMetadatas] description]];

Note: I tried adding an NSURL like this imageURL = [info valueForKey:@"UIImagePickerControllerReferenceURL"];, in the “pickerDidFinish” method but the metadata is null after I add this URL to the above code.

  • 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-18T09:28:12+00:00Added an answer on June 18, 2026 at 9:28 am

    If you are using the imagePickerController, the delegate method will give you what you need

    - (void) imagePickerController:(UIImagePickerController *)picker
     didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        if ([[info allKeys] containsObject:UIImagePickerControllerReferenceURL]){
            // you will get this key if your image comes from a library
            [self setMetaDataFromAssetLibrary:info];
        } else if ([[info allKeys] containsObject:UIImagePickerControllerMediaMetadata]){
            // if the image comes from the camera you get the metadata in it's own key
            self.rawMetaData = [self metaDataFromCamera:info];
        }
    }
    

    From Asset Library – bear in mind that it takes time to complete and has an asynchronous completion block, so you might want to add a completion flag to ensure you don’t access the property before it has been updated.

    - (void) setMetaDataFromAssetLibrary:(NSDictionary*)info
    {
        NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];
    
        ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
        [library assetForURL:assetURL
                 resultBlock:^(ALAsset *asset)  {
                     self.rawMetaData = asset.defaultRepresentation.metadata;
                 }
                failureBlock:^(NSError *error) {
                    NSLog (@"error %@",error);
                }];
    }
    

    From Camera:

        - (NSDictionary*)metaDataFromCamera:(NSDictionary*)info
       {
            NSMutableDictionary *imageMetadata = [info objectForKey:UIImagePickerControllerMediaMetadata];
           return imageMetadata;
       }
    

    Here is how to get metadata from a UIImage

      - (NSDictionary*)metaDataFromImage:(UIImage*)image
       {
            NSData *jpegData = [NSData dataWithData:UIImageJPEGRepresentation(image, 1.0)];
            return [self metaDataFromData:jpegData];
        }
    

    But take care – a UIImage can already stripped of much of the metadata from the original.. you will be better off getting the metadata from the NSData that was used to create the UIImage…

        - (NSDictionary*)metaDataFromData:(NSData*)data
    {
        CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
        CFDictionaryRef imageMetaData = CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
        return (__bridge NSDictionary *)(imageMetaData);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I extract this variable bellow from a website to my android code?
I wanted to extract Url of image from html code, e.g. html code below:
I have this code below. As you can see I am passing two variables
How can this code compile? The code below in the operator int CAN access
I ended up with this horrible code below, I can't get a better result
I have this kind of code below, how can I bind the visibility of
any idea how i can get the code below to produce this output? 1
I can't get this code to work. Declared playpauseButton just above the given below
I know how to do this... I'll give example code below. But I can't
I am using a library called EXIFextractor to extract metadata information from images. This

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.