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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:07:02+00:00 2026-06-12T07:07:02+00:00

I am writing an image in iPad using ALAssets. When it finish I try

  • 0

I am writing an image in iPad using ALAssets. When it finish I try to create an UIImage with the returned URL but it won’t load. This is the code:

LAssetsLibrary *library = [[ALAssetsLibrary alloc] init];  
    [library writeImageToSavedPhotosAlbum:[anImage CGImage] orientation:(ALAssetOrientation)[anImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){  
        if (!error) {
            CGImageSourceRef src = CGImageSourceCreateWithURL((CFURLRef) [NSURL fileURLWithPath:[assetURL absoluteString]], NULL);

My purpose is to save an image to the device, then convert it to another format using ImageIO and finally send it to a web service. CGImageSourceRef is null, I also tried with standard UIImage with the same result.

What I am doing wrong here?

EDIT: The problem is when creating the CFURLRef.
If I do

CGImageSourceCreateWithURL((CFURLRef) assetURL, NULL);

I got this error

ImageIO: CGImageSourceCreateWithURL CFURLCreateDataAndPropertiesFromResource failed with error code -11.

But if I try to convert the URL with

[NSURL fileURLWithPath:[assetURL absoluteString]]

the path is changed to

assets-library:/asset/asset.JPG%3Fid=57BBBA99-E7BF-4DB7-839E-F915005E6DFA&ext=JPG -- file://localhost/

I cannot find how to properly create the CFURLRef needed by the method. I tried printing all the conversions I could think of and this are the results

[assetURL relativePath]
[assetURL relativeString]
[assetURL absoluteURL]
[assetURL absoluteString]
 /asset.JPG ,
 assets-library://asset/asset.JPG?id=57BBBA99-E7BF-4DB7-839E-F915005E6DFA&ext=JPG
 assets-library://asset/asset.JPG?id=57BBBA99-E7BF-4DB7-839E-F915005E6DFA&ext=JPG
 assets-library://asset/asset.JPG?id=57BBBA99-E7BF-4DB7-839E-F915005E6DFA&ext=JPG

[NSURL fileURLWithPath:[assetURL relativePath]]
[NSURL fileURLWithPath:[assetURL relativeString]]
[NSURL fileURLWithPath:[assetURL absoluteString]]
file://localhost/asset.JPG
assets-library:/asset/asset.JPG%3Fid=57BBBA99-E7BF-4DB7-839E-F915005E6DFA&ext=JPG -- file://localhost/
assets-library:/asset/asset.JPG%3Fid=57BBBA99-E7BF-4DB7-839E-F915005E6DFA&ext=JPG -- file://localhost/

Help please, I am stuck with this 🙁

  • 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-12T07:07:03+00:00Added an answer on June 12, 2026 at 7:07 am

    This is what I did for my case.

        UIImage* anImage;   //this is the original image    
        NSData * imgData = UIImageJPEGRepresentation(anImage, 0.7);
        CGImageSourceRef src = CGImageSourceCreateWithData((CFDataRef) imgData, NULL);
    
        NSMutableData *data = [NSMutableData data];
        CFStringRef imageType = CFSTR("com.microsoft.bmp");
        CGImageDestinationRef myImageDest = CGImageDestinationCreateWithData((CFMutableDataRef) data, imageType, 1, nil);
    
        //Convert!
        CGImageDestinationAddImageFromSource(myImageDest, src, 0, myOptions);
        CGImageDestinationFinalize(myImageDest);
        //Freeing things
        CFRelease(myImageDest);
        CFRelease(src);
    

    But this just converts the image, it doesn’t store it in any file… Not sure this should be an answer to the original question.

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

Sidebar

Related Questions

I'm writing this script to rotate a background Image every 3 seconds but it
I'm writing a simple image upload function with php + image magick using amazon
I am writing a game in iPad using cocos2d. I need to mix two
Currently I am writing an iPad app. I am using a lot of images
I'm currently writing an image editing application using Flex and I'm trying to make
I'm writing on an image using: float shadowColorValues[] = {0, 0, 0, .3}; CGContextSetShadowWithColor(context,
I am writing an application for iPad using phonegap (Simple application using HTML5 and
I'm writing a Image gallery using Qt/QML and I want to show all images
I am writing an image upload form using ASP.NET MVC 3. In the view,
I'm writing a website/iPad app (using PhoneGap ), where I have 1024x768 images on

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.