Image Batch Processing
Image Batch Processing
- Subject: Image Batch Processing
- From: "Jere Gmail" <email@hidden>
- Date: Fri, 21 Sep 2007 17:19:00 +0200
HI, I've been trying to do a batch converter for images. The problem
is the memory is not being released properly. When the for ends the
memory is ok, but during the for it continues increasing. I have a
function with a for loop:
for(count=0;count<cant;count++)
{
path=[datos objectAtIndex:count];
save_name=[NSString stringWithFormat:
@"image_d.jpg",count+1];
output=[[batch_outdir stringValue]
stringByAppendingPathComponent:save_name];
[self convert:path path_out:output format:NSJPEGFileType quality:
0.3];
}
and then the conversion function
-(void)convert:(NSString*)path_in path_out:(NSString*)path_out format:
(NSBitmapImageFileType)type quality:(float)q
{
NSDictionary *d=[NSDictionary dictionaryWithObject:
[NSNumber numberWithFloat:q]
forKey:NSImageCompressionFactor];
NSImage *tmp_img;
NSBitmapImageRep *b;
NSData *data;
tmp_img=[[NSImage alloc] initWithContentsOfFile:path_in];
b=[NSBitmapImageRep imageRepWithData:[tmp_img TIFFRepresentation]];
[tmp_img release];
data=[b representationUsingType:tipo properties:d];
[data writeToFile:path_out atomically:TRUE];
}
--
http://zon7blog.blogspot.com/
And again we fall.
_______________________________________________
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