Du erzeugst die NSImageRep-Instanz ja mit einem Convenience Allocator, d.h. die Instanz ist autoreleased und darf daher nicht noch einmal released werden. Solche autoreleasten Objekte wirst Du nur dann schneller los, wenn Du das ganze in einen lokalen Autoreleasepool "einpackst".
	
		
			
		
		
	
			Alles anzeigen
		
								
			
Michael
									
									
								Quellcode
- - (NSArray*) imageResolution: (NSString*) path
- {
- NSAuroreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSImageRep * myImageRep = [NSImageRep imageRepWithContentsOfFile:path];
- NSString *w = [NSString stringWithFormat:@"%0.d",[myImageRep pixelsWide]];
- NSString *h = [NSString stringWithFormat:@"%0.d",[myImageRep pixelsHigh]];
- NSString *r = [NSString stringWithFormat:@"%0.lf",(([myImageRep pixelsHigh] * 72) / [myImageRep size].height)];
- NSString *s = [NSString stringWithFormat:@"%0.2f",([[[fileManager fileAttributesAtPath:path traverseLink:YES] objectForKey:NSFileSize] floatValue] / 1024 / 1024)];
- [pool release];
- return [NSArray arrayWithObjects:w,h,r,s,nil];
- }
Michael

