1.NSString to NSImage
NSString *filePath =@"/Users/mac-d1/work/Untitled.gif";
NSImage *gifImage = [[NSImage alloc] initWithContentsOfFile:filePath];
2.NSImage to NSData
<pre name="code" class="objc">NSImage *gifImage = [[NSImage alloc] initWithContentsOfFile:filePath];
NSData *imageData = [gifImage TIFFRepresentation];
3.NSData to NSImage
NSImage *image = [[NSImage alloc] initWithData:data];
4.NSString to std::string
NSString *filepath = @"test.png";
std::string str(filepath UTF8String);