Converting NSImage to cmtk yeilds green images
Converting NSImage to cmtk yeilds green images
- Subject: Converting NSImage to cmtk yeilds green images
- From: Ken Tozier <email@hidden>
- Date: Fri, 14 Jan 2011 17:06:37 -0500
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@hidden)
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:
This email sent to email@hidden