title: Color Space options for CIContext
body: <p>When creating a Core Image <a href="https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/QuartzCoreFramework/Classes/CIContext_Class/Reference/Reference.html#//apple_ref/occ/clm/CIContext/contextWithCGLContext:pixelFormat:colorSpace:options:" rel="noreferrer">CIContext</a> using the following:</p>
  
  <pre><code>contextWithCGLContext:pixelFormat:colorSpace:options:
  </code></pre>
  
  <p>You can specify a color space with a <code>CGColorSpaceRef</code>. However, the <code>options</code> dictionary that you can pass also allows you to set certain color space parameters. From <a href="https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/QuartzCoreFramework/Classes/CIContext_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Context_Options" rel="noreferrer">Apple's documentation</a>:</p>
  
  <blockquote>
    <p><code>kCIContextOutputColorSpace</code></p>
    
    <p>A key for the color space to use for images before they are rendered
    to the context. By default, Core Image uses the GenericRGB color
    space, which leaves color matching to the system. You can specify a
    different output color space by providing a Quartz 2D CGColorSpace
    object (CGColorSpaceRef). (See Quartz 2D Programming Guide for
    information on creating and using CGColorSpace objects.)</p>
    
    <p><code>kCIContextWorkingColorSpace</code></p>
    
    <p>A key for the color space to use for image operations. By default,
    Core Image assumes that processing nodes are 128 bits-per-pixel,
    linear light, premultiplied RGBA floating-point values that use the
    GenericRGB color space. You can specify a different working color
    space by providing a Quartz 2D CGColorSpace object (CGColorSpaceRef).
    Note that the working color space must be RGB-based. If you have YUV
    data as input (or other data that is not RGB-based), you can use
    ColorSync functions to convert to the working color space. (See Quartz
    2D Programming Guide for information on creating and using
    CGColorSpace objects.)</p>
  </blockquote>
  
  <p>My question is, how do these various color space parameters interact?</p>
  
  <p>My assumption would be that creating the CIContext with with a color space set using the <code>colorspace:</code> parameter above would be the same as setting the color space using the <code>kCIContextOutputColorSpace</code> in the <code>options:</code> dictionary. Is that correct? If not, what does each parameter mean?</p>
  
  <p>If so, then what happens if the color space is set using both the <code>colorspace:</code> parameter as well as the <code>kCIContextOutputColorSpace</code> key in the <code>options:</code> dictionary? Does one override the other? Is there some other behavior?</p>