Hi all, I'm trying to use NSImage in a Cocoa Console App, but every time I tried to save the NSImage into a file through NSImageRep, it failed with NSData.length = 0.
This is what I did: NSImage *surface = [[NSImage alloc] initWithSize:NSMakeSize(786 * 2, 1144 * 2)]; NSBitmapImageRep *jpgRep = [NSBitmapImageRep imageRepWithData:[surface TIFFRepresentation]]; NSDictionary *jpgProp = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:0.7] forKey:NSImageCompressionFactor]; NSData *dat = [jpgRep representationUsingType:NSJPEGFileType properties :jpgProp]; if ([dat length] == 0) NSLog(@"Data is zero"); [dat writeToFile:@"dummyfile.jpg" atomically:YES]; Anyone knows why? Thanks. _______________________________________________ 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