/// <summary>
        /// Renders a minature bitmap of the layers style
        /// </summary>
        /// <param name="service"></param>
        /// <param name="scale">The scale for the bitmap to match</param>
        /// <param name="layerdefinition">The layer definition resource id</param>
        /// <param name="themeIndex">If the layer is themed, this gives the theme index, otherwise set to 0</param>
        /// <param name="type">The geometry type, 1 for point, 2 for line, 3 for area, 4 for composite</param>
        /// <param name="width">The width of the image to request.</param>
        /// <param name="height">The height of the image to request.</param>
        /// <param name="format">The image format (PNG, JPG or GIF).</param>
        /// <returns>The legend image</returns>
        public static System.Drawing.Image GetLegendImage(this IMappingService service, double scale, string layerdefinition, int themeIndex, int type, int width, int height, string format)
        {
            var stream = service.GetLegendImageStream(scale, layerdefinition, themeIndex, type, width, height, format);

            return(System.Drawing.Image.FromStream(stream));
        }