public ScaleImage ( |
||
size | The desired output image size. | |
Résultat | void |
public void TestCropResize() { var expected = new Size(340, 300); _manipulator.ScaleImage(expected, true); Assert.AreEqual(expected, _manipulator.Image.Size); _manipulator = new ImageManipulator(new Bitmap(1024, 768)); _manipulator.ScaleImage(expected.Width, expected.Height, true); Assert.AreEqual(expected, _manipulator.Image.Size); }
private void btnOK_Click(object sender, EventArgs e) { var f = new FileInfo(FileName); var i = new ImageManipulator(FileName); i.ScaleImage(270, 300, true); string fileName = f.Name.Replace(f.Extension, ""); i.SaveImage(Common.Resources.ContentDirectory, fileName, ImageType.Png); //i.SaveImage("C:/Users/" + Environment.UserName + "/test/", fileName, ImageType.Png); _model.ImageUrl = Common.Resources.ContentDirectory + fileName + ".png"; //_model.ImageUrl = "C:/Users/" + Environment.UserName + "/test/" + fileName + ".png"; }