Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
19388c89a8 Improve color management for wide-gamut images with embedded profiles
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-07-30 14:14:43 +00:00
copilot-swe-agent[bot]
e017b3200d Enable color management by default for wide-gamut image support
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
2025-07-30 13:52:20 +00:00
copilot-swe-agent[bot]
de35ea77bc Initial plan 2025-07-30 13:42:18 +00:00
2 changed files with 23 additions and 6 deletions

View File

@@ -105,13 +105,30 @@ internal class ImageMagickProvider : AnimationProvider
{
mi = layers[0];
}
if (SettingHelper.Get("UseColorProfile", false, "QuickLook.Plugin.ImageViewer"))
if (SettingHelper.Get("UseColorProfile", true, "QuickLook.Plugin.ImageViewer"))
{
if (mi.ColorSpace == ColorSpace.RGB || mi.ColorSpace == ColorSpace.sRGB || mi.ColorSpace == ColorSpace.scRGB)
try
{
mi.SetProfile(ColorProfile.SRGB);
if (ContextObject.ColorProfileName != null)
mi.SetProfile(new ColorProfile(ContextObject.ColorProfileName)); // map to monitor color
// Apply color management for any color space that has embedded color profiles
// This includes Display P3, Adobe RGB, ProPhoto RGB, and other wide-gamut spaces
if (mi.HasColorProfile)
{
// If the image already has a color profile, preserve it and convert to monitor color space
if (ContextObject.ColorProfileName != null)
mi.SetProfile(new ColorProfile(ContextObject.ColorProfileName)); // map to monitor color
}
else if (mi.ColorSpace == ColorSpace.RGB || mi.ColorSpace == ColorSpace.sRGB || mi.ColorSpace == ColorSpace.scRGB)
{
// For images without embedded profiles, assume sRGB and convert to monitor color space
mi.SetProfile(ColorProfile.SRGB);
if (ContextObject.ColorProfileName != null)
mi.SetProfile(new ColorProfile(ContextObject.ColorProfileName)); // map to monitor color
}
}
catch (Exception e)
{
ProcessHelper.WriteLog($"Color profile conversion failed: {e}");
// Continue without color management if it fails
}
}

View File

@@ -65,7 +65,7 @@ public class Plugin : IViewer
public void Init()
{
var useColorProfile = SettingHelper.Get("UseColorProfile", false, "QuickLook.Plugin.ImageViewer");
var useColorProfile = SettingHelper.Get("UseColorProfile", true, "QuickLook.Plugin.ImageViewer");
AnimatedImage.AnimatedImage.Providers.Add(
new KeyValuePair<string[], Type>(