How to save a NSImage as a new file
原文连接:http://stackoverflow.com/questions/3038820/how-to-save-a-nsimage-as-a-new-file
How can I save a NSImage as a new file (png, jpg, ...) in a certain directory?
Thank you for answering my "noobish" question.
NSBitmapImageRep *imgRep = [[image representations] objectAtIndex: 0];
NSData *data = [imgRep representationUsingType: NSPNGFileType properties: nil];
[data writeToFile: @"/path/to/file.png" atomically: NO];