Hi

I'm trying to write an NSImage category that converts an image to cmyk . It 
sort of works, in that it does produce a new image, but all images have a dark 
green cast to them and look sort of solarized or like negatives. Anyone point 
out what I'm doing wrong?

Thanks for any help

- (NSImage *) cmykImage
{
        NSImage                         *result = [[NSImage alloc] 
initWithSize: [self size]];
                                                                
        NSBitmapImageRep                *rep            = [[NSBitmapImageRep 
alloc] 
                                                                                
                initWithBitmapDataPlanes: NULL
                                                                                
                pixelsWide: [self size].width
                                                                                
                pixelsHigh: [self size].height
                                                                                
                bitsPerSample: 8
                                                                                
                samplesPerPixel: 4
                                                                                
                hasAlpha: NO
                                                                                
                isPlanar: NO
                                                                                
                colorSpaceName: NSDeviceCMYKColorSpace
                                                                                
                bytesPerRow: 0
                                                                                
                bitsPerPixel: 0];
                                                                                
                
        NSGraphicsContext               *context        = [NSGraphicsContext 
graphicsContextWithBitmapImageRep: rep];
        
        [NSGraphicsContext setCurrentContext: context];
        
        [context setImageInterpolation: NSImageInterpolationHigh];

        [self compositeToPoint: NSZeroPoint operation: NSCompositeSourceOver];
        
        [result addRepresentation: rep];
        
        return result;
}_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to