/// <summary>
 /// Converts image pixel data to a byte array.
 /// </summary>
 /// <param name="image">
 /// The source image.
 /// </param>
 /// <returns>
 /// Returns an array of bytes containing the pixel data.
 /// </returns>
 public static byte[] ToByteArray(this GenericImage <Color> image)
 {
     return(image.ToByteArray(0, 0, image.Width, image.Height));
 }
        /// <summary>
        /// Saves the image data to a stream.
        /// </summary>
        /// <param name="image">
        /// The source image.
        /// </param>
        /// <param name="stream">
        /// The stream that will be written to.
        /// </param>
        /// <remarks>Only writes the raw pixel data and does not include any width, height, color depth info etc.</remarks>
        public static void Save(this GenericImage <Color> image, Stream stream)
        {
            var data = image.ToByteArray();

            stream.Write(data, 0, data.Length);
        }