better NConvert decoding

This commit is contained in:
Paddy Xu
2018-09-02 14:09:01 +03:00
parent e4db93704e
commit 187fe2649b
3 changed files with 12 additions and 5 deletions

View File

@@ -49,13 +49,12 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
img.BeginInit();
img.UriSource = new Uri(Path);
img.CacheOption = BitmapCacheOption.OnLoad;
img.DecodePixelWidth = (int) decodeWidth;
img.DecodePixelHeight =
(int) decodeHeight; // specific size to avoid .net's double to int conversion
img.DecodePixelWidth = decodeWidth;
img.DecodePixelHeight = decodeHeight; // specific size to avoid .net's double to int conversion
img.EndInit();
var scaled = new TransformedBitmap(img,
new ScaleTransform(fullSize.Width / decodeWidth, fullSize.Height / decodeHeight));
new ScaleTransform(fullSize.Width / img.PixelWidth, fullSize.Height / img.PixelHeight));
scaled.Freeze();
return scaled;
}