How to get the generated Thumbnail from WpfThumbnailViewer as BitmapImage
Posted: Wed Sep 16, 2015 5:50 pm
How to get the generated Thumbnail from WpfThumbnailViewer as BitmapImage. My code always return the full size of the original image. Something`s wrong with my code or yours.
Here`s my code
Sébastien Comeau
Here`s my code
Code: Select all
// generate thumbnail image source
BitmapImage imageSource = new BitmapImage();
using(MemoryStream ms = new MemoryStream())
{
thumbnailImageItem.Source.Thumbnail.GetThumbnailImage(64, 64).Save(ms, new Vintasoft.Imaging.Codecs.Encoders.JpegEncoder());
ms.Seek(0, SeekOrigin.Begin);
imageSource.BeginInit();
imageSource.StreamSource = ms;
imageSource.EndInit();
}