• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Converting NSImage to cmtk yeilds green images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Converting NSImage to cmtk yeilds green images
      • From: Ken Ferry <email@hidden>
  • Prev by Date: Re: UIDatePicker displays incorrect day in UIDatePickerDateAndTime mode for zones 12+ hours ahead of defaultZone
  • Next by Date: Re: NSUndoManager retain/release of arguments - ad infinitum
  • Previous by thread: Re: mouseDown in NSSegmentedControl
  • Next by thread: Re: Converting NSImage to cmtk yeilds green images
  • Index(es):
    • Date
    • Thread