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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:32:55+00:00 2026-06-12T22:32:55+00:00

I am having trouble with getting a UIImage from and CIImage. The line of

  • 0

I am having trouble with getting a UIImage from and CIImage. The line of code below works fine on iOS6: (Output image is an CIImage)

self.imageView = [UIImage imageWithCIImage:outputImage];

or

[self.imageView setImage:[UIImage imageWithCIImage:outputImage]];

When I run this same line of code on a device that is running iOS 5 the imageView is blank. If I log the size property of the UIImage it is correct but the image never displays on the screen.

When I use a CGImageRef (as shown below) it works fine on both devices but it causes huge memory growth when I do a heap shot analysis.

context = [CIContext contextWithOptions:nil];
CGImageRef ref = [context createCGImage:outputImage fromRect:outputImage.extent];
self.imageView.image = [UIImage imageWithCGImage:ref scale:1.0 orientation:UIImageOrientationUp];
CGImageRelease(ref);

Does anyone know why UIImage imageWithCIImage does not work? According to the UIImage class reference it should work on iOS5 and above. Also why does using CGImageRef cause such massive heap growth?

Thank you

  • 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-12T22:32:58+00:00Added an answer on June 12, 2026 at 10:32 pm

    On iOS 5.0, -imageWithCIImage: never seemed to work properly, and we were told to use the -createCGImage:fromRect: approach you describe above in order to render the Core Image filter chain to a raster output.

    As you see, the downside to this is that -createCGImage:fromRect: creates a new CGImageRef at the size of your target image, and the bitmap at its heart is passed on to your new UIImage. This probably means that you have at least two full bitmaps representing your final filtered frame in memory at one point, which could cause quite a spike if these are large images.

    It appears that -imageWithCIImage: has been fixed in iOS 6.0 (Core Image has had a lot of improvements made from 5.0 to 6.0). While I can only speculate as to why it doesn’t lead to this memory spike, I bet it’s due to the use of a texture cache to share memory between the output OpenGL ES texture from the filtering process and the final bitmap that’s stored in your UIImage. I do this in my GPUImage framework to cut down on memory consumption when filtering large images, and it would make sense for Core Image to do the same. Again, this is just speculation.

    Unfortunately, it looks like you’ll need to do a little version testing here and fall back to the old way of getting output from CIImages if you want to support iOS 5.0 with your application.

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

Sidebar

Related Questions

Having trouble getting the following code to work. Calling swapLevel() directly works fine, but
Having trouble getting the javascript alert to display from my code behind. c# -
im having trouble getting a string (containing a URL) from one activity to another.
I'm currently having trouble getting example code for using tweepy to access Twitter's Streaming
Having trouble getting fancybox to display my image correctly, I use ASP.NET: <a class=fancybox
I'm having trouble getting the value from this function, I'm not sure why but
Having trouble getting the oauth access token and secret exchanged from the request tokens
Having trouble getting my POST arrays to show all checkbox values from my form.
I'm having trouble getting my line breaks to show up in a textarea. The
I'm having trouble getting a string URL to format correctly. The desired output is

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.