If I have a file, I can get the icon by doing something such as:
NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile: @\"myFile.png\"];
You can first determine file type (UTI) and then pass it on to get icon:
NSString *fileName = @"lemur.jpg"; // generic path to some file
CFStringRef fileExtension = (__bridge CFStringRef)[fileName pathExtension];
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
NSImage *image = [[NSWorkspace sharedWorkspace]iconForFileType:(__bridge NSString *)fileUTI];