ImageAttributes.SetOutputChannel Method (ColorChannelFlag, ColorAdjustType)
Sets the CMYK (cyan-magenta-yellow-black) output channel for a specified category.
Assembly: System.Drawing (in System.Drawing.dll)
You can use the SetOutputChannel method to convert an image to a CMYK color space and examine the intensities of one of the CMYK color channels. For example, suppose you create an ImageAttributes object and set its bitmap output channel to ColorChannelC. If you pass the path of that ImageAttributes object to the DrawImage method, the cyan component of each pixel is calculated, and each pixel in the rendered image is a shade of gray that indicates the intensity of its cyan channel. Similarly, you can render images that indicate the intensities of the magenta, yellow, and black channels.
An ImageAttributes object maintains color and grayscale settings for five adjustment categories: default, bitmap, brush, pen, and text. For example, you can specify an output channel for the default category and a different output channel for the bitmap category.
The default color-adjustment and grayscale-adjustment settings apply to all categories that do not have adjustment settings of their own. For example, if you never specify any adjustment settings for the bitmap category, the default settings apply to the bitmap category.
As soon as you specify a color-adjustment or grayscale-adjustment setting for a certain category, the default adjustment settings no longer apply to that category. For example, suppose you specify a collection of adjustment settings for the default category. If you set the output channel for the bitmap category by passing Bitmap to the SetOutputChannel method, none of the default adjustment settings will apply to bitmaps.
The following code example demonstrates how to use the SetOutputChannel method. To run this example, paste the following code into a Windows Form. Handle the form's Paint event and call ShowOutputChannels, passing e asPaintEventArgs.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.