CSharp examples for System.Drawing:Color Convert
Converts from a Color to HSV values (byte)
using System.Windows.Media; using System.Globalization; using System;/*from www . j av a 2 s .c o m*/ public class Main{ /// <summary> /// Converts from a <see cref="Color"/> to HSV values (byte) /// </summary> /// <param name="color"> /// </param> /// <returns> /// Array of [Hue,Saturation,Value] in the range [0,255] /// </returns> public static byte[] ColorToHsvBytes(Color color) { double[] hsv1 = ColorToHsv(color); var hsv2 = new byte[3]; hsv2[0] = (byte)(hsv1[0] * 255); hsv2[1] = (byte)(hsv1[1] * 255); hsv2[2] = (byte)(hsv1[2] * 255); return hsv2; } }