| Q: I'd like to associate a ColorSync profile with a given NSBitmapImageRepobject for color-matching purposes. Is there a simple way to do this?A: You can associate a ColorSync profile with a NSBitmapImageRepobject containing pixel data produced by decoding a TIFF, JPEG, GIF or PNG file using the-setProperty:method and theNSImageColorSyncProfileDataproperty. Here's a short code snippet showing how it's done: Listing 1: Setting the ColorSync profile for a NSBitmapImageRep object. 
//
// imageRepWithProfileAtPath
//
// Associate a given file-based ColorSync profile with
// a NSBitmapImageRep object
//
// Inputs:
//
//    aPath    - file path for a ColorSync profile
//
// Outputs:
//
//    - returns a new NSBitmapImageRep object, created
//    by copying the receiver and applying the ColorSync
//    profile.
@implementation NSBitmapImageRep (MoreColorMethods)
- (NSBitmapImageRep *) imageRepWithProfileAtPath:(NSString *) pathToProfile
{
    id result = [self copy];
        // build a NSData object for our ColorSync profile file
    id profile = [NSData dataWithContentsOfFile: pathToProfile];
        // now set the ColorSync profile for the object
    [result setProperty:NSImageColorSyncProfileData withValue:profile];
    return [result autorelease];
}
@end
Document Revision History| Date | Notes | 
|---|
 | 2004-09-08 | Setting the ColorSync profile for a NSBitmapImageRep object | 
 Posted: 2004-09-08 |