/// <summary> /// Exports the specified image to the specified file formats and types. /// </summary> /// <param name="image">Specifies the image to export.</param> /// <param name="imageType">Specifies image types (i.e. color, grayscale, monochrome).</param> /// <param name="resolution">Specifies the resolution for the image.</param> /// <param name="fileFormat">Specifies file formats (i.e. BMP, JPEG, etc).</param> /// <param name="path">Specifies destination directory.</param> /// <param name="filename">Specifies the string that is used in the filename pattern.</param> /// <exception cref="T:System.ArgumentNullException"> /// <para><paramref name="image"/> is <see langword="null"/>.</para> /// -or- /// <para><paramref name="path"/> is <see langword="null"/> or empty string.</para> /// -or- /// <para><paramref name="filename"/> is <see langword="null"/> or empty string.</para> /// </exception> /// <exception cref="T:System.ArgumentException"> /// Width or height of the <paramref name="resolution"/> structure are not positive. /// </exception> public void Export(Image image, NuGenImageType imageType, NuGenImageFileFormat fileFormat, Size resolution, string path, string filename) { if (image == null) { throw new ArgumentNullException("image"); } if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException("filename"); } image = NuGenControlPaint.GetThumbnail(image, resolution); if ((imageType & NuGenImageType.Color) != 0) { this.ExportToFileFormat( (Bitmap)image, fileFormat, path, string.Format("{0}_Color", filename) ); } if ((imageType & NuGenImageType.Grayscale) != 0) { this.ExportToFileFormat( NuGenControlPaint.GetGrayscaleBitmap((Bitmap)image), fileFormat, path, string.Format("{0}_Grayscale", filename) ); } if ((imageType & NuGenImageType.Monochrome) != 0) { this.ExportToFileFormat( NuGenControlPaint.GetMonochromeBitmap((Bitmap)image), fileFormat, path, string.Format("{0}_Monochrome", filename) ); } }