Fix #292: Handle possible exception when changing colour profile

This commit is contained in:
Paddy Xu
2018-07-14 17:44:18 +03:00
parent f0131a36ac
commit 1ae40a0019

View File

@@ -52,8 +52,16 @@ namespace QuickLook.Plugin.ImageViewer.AnimatedImage
return new Task<BitmapSource>(() => return new Task<BitmapSource>(() =>
{ {
using (var image = new MagickImage(_path)) using (var image = new MagickImage(_path))
{
try
{ {
image.AddProfile(ColorProfile.SRGB); image.AddProfile(ColorProfile.SRGB);
}
catch (MagickResourceLimitErrorException)
{
// https://github.com/xupefei/QuickLook/issues/292: ColorspaceColorProfileMismatch
}
image.Density = new Density(Math.Floor(image.Density.X), Math.Floor(image.Density.Y)); image.Density = new Density(Math.Floor(image.Density.X), Math.Floor(image.Density.Y));
image.AutoOrient(); image.AutoOrient();