• 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
Image Batch Processing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Image Batch Processing
      • From: Simone Tellini <email@hidden>
    • Re: Image Batch Processing
      • From: "Daniel T. Staal" <email@hidden>
  • Prev by Date: Re: Question about scope of "convenience objects"
  • Next by Date: Re: Question about scope of "convenience objects"
  • Previous by thread: Re: Question about scope of "convenience objects"
  • Next by thread: Re: Image Batch Processing
  • Index(es):
    • Date
    • Thread