public void CreateThumbnailFromFolder() { const string path = @"Drawing\Resources\Averaging Test Images"; const int size = 100; File.Delete(@"CreateThumbnailFromFolder.jpg"); using (Image thumb1 = Thumbnail.CreateStack(path, size, ThumbnailStackType.Fan)) { Assert.IsNotNull(thumb1); JpgFormat.Save(@"CreateThumbnailFromFolder.jpg", thumb1, 100); } }
public void CreateThumbnailFromJpg() { using (Image image = Image.FromFile(@"Drawing\Resources\ULPT-L.jpg")) using (Image thumb = Thumbnail.FromImage(image, 134, 107)) { using (MemoryStream stream = new MemoryStream()) { JpgFormat.Save(stream, thumb, 80); using (Bitmap bitmap = MemoryBitmap.FromStream(stream)) { Assert.AreEqual(new Size(134, 107), bitmap.Size); } } } }