//save image in othe format, your cap public static void SaveImageInOtherFormat(Bitmap image, SupportFormats newFormat) { string imgName = GetImageInfo.Imginfo(Imageinfo.FileName); string defPath = GetImageInfo.MyPath("Rand"); string outName = defPath + imgName + newFormat.ToString(); Helpers.SaveOptions(image, outName, newFormat.ToString().ToLower()); }
public ListFormats(ListBox ListBox) { this.ListBox = ListBox; ListBox.SelectionChanged += ListBox_SelectionChanged; SupportFormats FormatsType = new SupportFormats(); Formats = FormatsType.GetAllFormats(); RefereshContent(); }
/* ----------------------------------------------------------------- */ /// /// GetItextImage /// /// <summary> /// Converts from System.Drawing.Image to iTextSharp.text.Image. /// </summary> /// /// <param name="image">Source image.</param> /// /// <returns>Converted image.</returns> /// /* ----------------------------------------------------------------- */ public static iTextSharp.text.Image GetItextImage(this Image image) { var scale = PdfFile.Point / image.HorizontalResolution; var format = image.GetImageFormat(); if (!SupportFormats.Contains(format)) { format = ImageFormat.Png; } var dest = iTextSharp.text.Image.GetInstance(image, format); dest.SetAbsolutePosition(0, 0); dest.ScalePercent(scale * 100); return(dest); }