public static void PerformImageResizeAndPutOnCanvas(string pFilePath, string pFileName, int pWidth, int pHeight, string pOutputFileName) { System.Drawing.Image imgBef; imgBef = System.Drawing.Image.FromFile(pFilePath + pFileName); System.Drawing.Image _imgR; _imgR = Imager.Resize(imgBef, pWidth, pHeight, true); System.Drawing.Image _img2; _img2 = Imager.PutOnCanvas(_imgR, pWidth, pHeight, System.Drawing.Color.White); //Save JPEG Imager.SaveJpeg(pFilePath + pOutputFileName, _img2); }
public void saveImage() { int num = 0; if (count == 2) { num = files.Count(); } foreach (ImagePreview t in files) { int h; int w; if (heigth == 0) { h = t.image.Height; } else { h = heigth; } if (width == 0) { w = t.image.Width; } else { w = width; } var imgX1 = Imager.Resize(t.image, (int)(w * more), (int)(h * more), true); var imgX2 = Imager.Resize(t.image, (int)(w * 2 * more), (int)(h * 2 * more), true); var imgX3 = Imager.Resize(t.image, (int)(w * 3 * more), (int)(h * 3 * more), true); string[] name = t.path.Split('\\'); string[] nameFile = name[name.Length - 1].Split('.'); imgX1.Save(Path.Combine(folderBrowserDialog.SelectedPath, nameFile[0] + "." + nameFile[1])); imgX2.Save(Path.Combine(folderBrowserDialog.SelectedPath, nameFile[0] + "@2x." + nameFile[1])); imgX3.Save(Path.Combine(folderBrowserDialog.SelectedPath, nameFile[0] + "@3x." + nameFile[1])); ++num; //this.Invoke(updateProgress ,(int)(((double)num / (double)(files.Count * count)) * 100)); } MessageBox.Show("Compleate", "Compleate"); Invoke(end); }