• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Best way to save a CIImage to disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Best way to save a CIImage to disk


  • Subject: Best way to save a CIImage to disk
  • From: Jan-Willem Buurlage <email@hidden>
  • Date: Mon, 4 May 2009 22:58:54 +0200

I'm running a CIImage through some CIFilters, and I want to save the returned CIImage to disk. Everything is very fast up until the point where I try to actually save the image. I first create an NSBitmapImageRep with my CIImage, get the needed NSData from that object, and then save it to disk. Not only is this incredibly slow, Instrument shows that the memory gets filled up extremely fast as well. In fact, when I input a couple dozen files into my program it takes longer and longer for it to process them, and eventually the application just freezes.
Here's the relevant code:


for(NSString* file in fileArray) {
.....
//filter the image
CIImage* result = [self filterImage:source];

//saving to disk
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCIImage:result];
NSData* PNGData = [rep representationUsingType:NSPNGFileType properties:nil];
[PNGData writeToFile:targetPath atomatically:NO];
....
}


Obviously there must be some better way to do this. And why does my memory fill up? The leak must be in these couple of lines. If anyone can help me towards the direction I should look in that would be very much appreciated.

Thanks,
Jan-Willem
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Best way to save a CIImage to disk
      • From: Michael Ash <email@hidden>
  • Prev by Date: TCPServer Example
  • Next by Date: NSPredicateEditorRowTemplate and switching views
  • Previous by thread: Re: TCPServer Example
  • Next by thread: Re: Best way to save a CIImage to disk
  • Index(es):
    • Date
    • Thread