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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to