diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NConvertImageProvider.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NConvertImageProvider.cs index ca82991..5917bff 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NConvertImageProvider.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NConvertImageProvider.cs @@ -36,6 +36,11 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage public override Task GetThumbnail(Size size, Size fullSize) { + var decodeWidth = (int) Math.Round(fullSize.Width * + Math.Min(size.Width / 2 / fullSize.Width, + size.Height / 2 / fullSize.Height)); + var decodeHeight = (int) Math.Round(fullSize.Height / fullSize.Width * decodeWidth); + return new Task(() => { try @@ -46,11 +51,14 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage img.BeginInit(); img.StreamSource = ms; img.CacheOption = BitmapCacheOption.OnLoad; + 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 / img.PixelWidth, fullSize.Height / img.PixelHeight)); scaled.Freeze(); + return scaled; } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NativeImageProvider.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NativeImageProvider.cs index 6a5ff14..8d19364 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NativeImageProvider.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/AnimatedImage/NativeImageProvider.cs @@ -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; } diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs index dcc0d2f..02bcf45 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Plugin.cs @@ -88,7 +88,7 @@ namespace QuickLook.Plugin.ImageViewer context.ViewerContent = _ip; context.Title = size.IsEmpty ? $"{Path.GetFileName(path)}" - : $"{Path.GetFileName(path)} ({size.Width}×{size.Height})"; + : $"{size.Width}×{size.Height}: {Path.GetFileName(path)}"; _ip.ImageUriSource = new Uri(path); }