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

  • Home
  • SEARCH
  • 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 9014941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:37:45+00:00 2026-06-16T03:37:45+00:00

My main problem is i need to obtain a thumbnail for an ALAsset object.

  • 0

My main problem is i need to obtain a thumbnail for an ALAsset object.

I tried a lot of solutions and searched stack overflow for days, all the solutions i found are not working for me due to these constraint:

  • I can’t use the default thumbnail because it’s too little;
  • I can’t use the fullScreen or fullResolution image because i have a lot of images on screen;
  • I can’t use UIImage or UIImageView for resizing because those loads
    the fullResolution image
  • I can’t load the image in memory, i’m working with 20Mpx images;
  • I need to create a 200×200 px version of the original asset to load on screen;

this is the last iteration of the code i came with:

#import <AssetsLibrary/ALAsset.h>
#import <ImageIO/ImageIO.h>   

// ...

ALAsset *asset;

// ...

ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation];

NSDictionary *thumbnailOptions = [NSDictionary dictionaryWithObjectsAndKeys:
    (id)kCFBooleanTrue, kCGImageSourceCreateThumbnailWithTransform,
    (id)kCFBooleanTrue, kCGImageSourceCreateThumbnailFromImageAlways,
    (id)[NSNumber numberWithFloat:200], kCGImageSourceThumbnailMaxPixelSize,
    nil];

CGImageRef generatedThumbnail = [assetRepresentation CGImageWithOptions:thumbnailOptions];

UIImage *thumbnailImage = [UIImage imageWithCGImage:generatedThumbnail];

problem is, the resulting CGImageRef is neither transformed by orientation, nor of the specified max pixel size;

I also tried to find a way of resizing using CGImageSource, but:

  • the asset url can’t be used in the CGImageSourceCreateWithURL:;
  • i can’t extract from ALAsset or ALAssetRepresentation a CGDataProviderRef to use with CGImageSourceCreateWithDataProvider:;
  • CGImageSourceCreateWithData: requires me to store the fullResolution or fullscreen asset in memory in order to work.

Am i missing something?

Is there another way of obtaining a custom thumbnail from ALAsset or ALAssetRepresentation that i’m missing?

Thanks in advance.

  • 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-16T03:37:46+00:00Added an answer on June 16, 2026 at 3:37 am

    You can use CGImageSourceCreateThumbnailAtIndex to create a small image from a potentially-large image source. You can load your image from disk using the ALAssetRepresentation‘s getBytes:fromOffset:length:error: method, and use that to create a CGImageSourceRef.

    Then you just need to pass the kCGImageSourceThumbnailMaxPixelSize and kCGImageSourceCreateThumbnailFromImageAlways options to CGImageSourceCreateThumbnailAtIndex with the image source you’ve created, and it will create a smaller version for you without loading the huge version into memory.

    I’ve written a blog post and gist with this technique fleshed out in full.

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

Sidebar

Related Questions

Have a problem. In my main Activity I have a ListView. And I need
I need to search some data in my database. But main problem is that
i need to get iframe content in javascript or jquery, but main problem is
My main problem is that I need to enable multiple OS processes to communicate
Main problem: how do i group elements by their Date, only if continuous and
The main problem is square-space builds their forms with java-script (YUI). They have are
The main problem I'm having is pulling data from tables, but any other general
My main problem is I don't understand how to get the position of the
It may sound odd, but I've been programming games in PHP. The main problem
Problem description : - Step 1: Take input FILE_NAME from user at main thread.

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.