public byte[] CreateThumnail(byte[] org, int width) { //TODO : wina width, height 값 때문에 일그러지는 현상이 있는 것 같다, PhotoResizer.ResizeImage 수정해야함 var thumnail = PhotoResizer.ResizeImage(org, width, width, 1); return(thumnail); }
public void CapaVerticalTest() { PhotoResizer pr = new PhotoResizer(); Image original = Image.FromFile(@"C:\Users\vitor\Dropbox\Projetos\FotUp\Testes\1099327.jpg"); pr.Crop( original.ToStream(ImageFormat.Jpeg), @"C:\Users\vitor\Dropbox\Projetos\FotUp\Testes\1099327.cover.jpg", 450); }
public void ResizeVerticalTest() { PhotoResizer pr = new PhotoResizer(); Image original = Image.FromFile(@"C:\Users\vitor\Dropbox\Projetos\FotUp\Testes\1099327.jpg"); pr.ResizeAndWatermark( original.ToStream(ImageFormat.Jpeg), @"C:\Users\vitor\Dropbox\Projetos\FotUp\Testes\horizontal.png", @"C:\Users\vitor\Dropbox\Projetos\FotUp\Testes\vertical.png", @"C:\Users\vitor\Dropbox\Projetos\FotUp\Testes\1099327.thumb.jpg", 450); }
public void SavedAndSizeIsCorrect() { var filePath = "..\\..\\..\\InputAssets\\IMG_2301.jpg"; var saveFilePath = Path.Combine(Path.GetTempPath(), "IMG_2301.jpg"); using (var load = new FileStream(filePath, FileMode.Open)) { var image = SystemDrawingImage.FromStream(load, false, false); load.Position = 0; using (var save = new FileStream(saveFilePath, FileMode.Create)) { PhotoResizer.Resize(load, save, image.Width, image.Height); } } Assert.IsTrue(File.Exists(saveFilePath)); using (var fs = new FileStream(saveFilePath, FileMode.Open)) { Assert.IsTrue(fs.Length > 0); var image = SystemDrawingImage.FromStream(fs, false, false); Assert.IsTrue(image.Width == PhotoResizer.DefaultThumbnailSize || image.Height == PhotoResizer.DefaultThumbnailSize); } }