/// <summary>
        /// Loads the default input CMYK ICC profile.
        /// </summary>
        private void LoadDefaultInputCmykProfile(ColorManagementDecodeSettings settings)
        {
            try
            {
                // search directories
                string[] directories = new string[]
                {
                    "",
                    @"..\..\..\..\Bin\DotNet4\AnyCPU\",
                };

                // search profile
                string defaultInputCmykFilename = "";
                foreach (string dir in directories)
                {
                    string profileDirectory = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), dir));
                    if (File.Exists(Path.Combine(profileDirectory, DEFAULT_INPUT_CMYK_PROFILE)))
                    {
                        defaultInputCmykFilename = Path.Combine(profileDirectory, DEFAULT_INPUT_CMYK_PROFILE);
                        break;
                    }
                }

                // if profile was found
                if (defaultInputCmykFilename != "")
                {
                    settings.InputCmykProfile = new IccProfile(defaultInputCmykFilename);
                }
            }
            catch
            {
            }
        }
 /// <summary>
 /// Sets curent settings to <see cref="ColorManagementSettings"/> property.
 /// </summary>
 private void SetSettings()
 {
     if (enableColorManagementCheckBox.Checked)
     {
         if (useEmbeddedProfilesCheckBox.Checked)
         {
             _colorManagementSettings.UseEmbeddedInputProfile = true;
         }
         else
         {
             _colorManagementSettings.UseEmbeddedInputProfile = false;
         }
         if (blackPointCompensationCheckBox.Checked)
         {
             _colorManagementSettings.UseBlackPointCompensation = true;
         }
         else
         {
             _colorManagementSettings.UseBlackPointCompensation = false;
         }
         _colorManagementSettings.RenderingIntent = (RenderingIntent)intentComboBox.SelectedItem;
     }
     else
     {
         _colorManagementSettings = null;
     }
 }
        /// <summary>
        /// Loads the default input CMYK ICC profile.
        /// </summary>
        private static void LoadDefaultInputCmykProfile(ColorManagementDecodeSettings colorManagementSettings)
        {
            try
            {
                // search directories
                string[] directories = new string[] {
                    "",
                    @"..\..\..\..\Bin\DotNet4\AnyCPU\",
                };

                // for each search directory
                foreach (string dir in directories)
                {
                    // create path to a CMYK profile file in search directory
                    string profileDirectory = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), dir));
                    string profileFilename  = Path.Combine(profileDirectory, DEFAULT_INPUT_CMYK_PROFILE);
                    // if CMYK profile file is found
                    if (File.Exists(profileFilename))
                    {
                        // set input CMYK profile in color management settings
                        colorManagementSettings.InputCmykProfile = new IccProfile(profileFilename);
                        return;
                    }
                }
            }
            catch
            {
            }
        }
        /// <summary>
        /// Handles the CheckedChanged event of EnableColorManagementCheckBox object.
        /// </summary>
        private void enableColorManagementCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            // if color managment must be used
            if (enableColorManagementCheckBox.Checked)
            {
                // enable decoding settings user interface
                decodingSettingsGroupBox.Enabled = true;

                // if color managment settings must be created
                if (_colorManagementSettings == null)
                {
                    // create color managment settings
                    ColorManagementDecodeSettings settings = new ColorManagementDecodeSettings();
                    // load default profiles
                    LoadDefaultInputCmykProfile(settings);
                    // update color managment settings
                    ColorManagementSettings = settings;
                }
            }
            else
            {
                // disable decoding settings user interface
                decodingSettingsGroupBox.Enabled = false;
            }
        }
        /// <summary>
        /// Initializes the color management settings.
        /// </summary>
        /// <param name="colorManagementSettings">Source color management settings.</param>
        /// <returns>
        /// New color management settings.
        /// </returns>
        public static ColorManagementDecodeSettings InitColorManagement(ColorManagementDecodeSettings colorManagementSettings)
        {
            // if color management settings does not exist
            if (colorManagementSettings == null)
            {
                // create new color management settings
                colorManagementSettings = new ColorManagementDecodeSettings();
            }

            // load the default input CMYK ICC profile
            LoadDefaultInputCmykProfile(colorManagementSettings);

            colorManagementSettings.UseEmbeddedInputProfile   = true;
            colorManagementSettings.UseBlackPointCompensation = true;

            return(colorManagementSettings);
        }