Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 30, 2025

QuickLook was failing to render Display P3 and other wide-gamut color space images correctly, showing washed-out or incorrect colors compared to Windows 11 Photos App. While the initial fix enabled color management by default, it had limitations in handling images with embedded color profiles.

Root Cause

The original color management logic was too restrictive - it only applied color profiles to images with RGB/sRGB/scRGB color spaces, but Display P3 and other wide-gamut images often have embedded color profiles that weren't being handled properly.

Changes Made

This PR enables color management by default and improves the handling of wide-gamut images:

  1. Plugin.cs line 68: Changed UseColorProfile default from false to true
  2. ImageMagickProvider.cs line 108: Changed UseColorProfile default from false to true
  3. Enhanced color management logic in ImageMagickProvider.cs:
    • Now detects and preserves embedded color profiles (Display P3, Adobe RGB, ProPhoto RGB, etc.)
    • Converts embedded profiles directly to monitor color space instead of forcing sRGB conversion
    • Falls back to sRGB assumption only for images without embedded profiles
    • Adds proper error handling to prevent crashes if color management fails

Technical Impact

The improved logic properly handles images with embedded color profiles by:

  • First checking if the image has an embedded color profile (mi.HasColorProfile)
  • Preserving the original profile and converting directly to monitor color space
  • Maintaining backward compatibility with the previous sRGB fallback logic
  • Adding resilience through error handling that continues gracefully if color management fails

Benefits

  • ✅ Fixes Display P3 and other wide-gamut image rendering issues
  • ✅ Properly handles images with embedded color profiles
  • ✅ Maintains backward compatibility for images without embedded profiles
  • ✅ Adds error handling to prevent color management crashes
  • ✅ Minimal risk - leverages existing ImageMagick color management infrastructure

Fixes #1725.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: emako <24737061+emako@users.noreply.github.com>
Copilot AI changed the title [WIP] Color Management Issue: Quick Look Fails to Render Wide-Gamut Images Correctly Enable color management by default for wide-gamut image support Jul 30, 2025
Copilot AI requested a review from emako July 30, 2025 13:55
Copilot finished work on behalf of emako July 30, 2025 13:55
@emako
Copy link
Member

emako commented Jul 30, 2025

The W can't be saw from issue image file, even if UseColorProfile is true.

Co-authored-by: emako <24737061+emako@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 30, 2025

The W can't be saw from issue image file, even if UseColorProfile is true.

I've improved the color management implementation to better handle wide-gamut images with embedded color profiles like Display P3. The original fix only applied color management to RGB/sRGB/scRGB color spaces, but Display P3 images often have embedded color profiles that weren't being handled properly.

The updated logic now:

  1. Checks if the image has an embedded color profile (which Display P3 images typically have)
  2. Preserves the original profile and converts directly to the monitor's color space
  3. Falls back to sRGB assumption only for images without embedded profiles
  4. Adds proper error handling to prevent crashes

This should resolve the issue where the "W" wasn't visible in Display P3 images. The improvement is in commit 19388c8.

Note that seeing the "W" in wide-gamut images also requires:

  • A wide-gamut capable monitor (like your 2.8K OLED HDR600)
  • Proper color profile configuration in Windows
  • The test image to actually contain wide-gamut colors outside the sRGB range

Copilot AI changed the title Enable color management by default for wide-gamut image support Improve color management for wide-gamut images with embedded profiles Jul 30, 2025
Copilot finished work on behalf of emako July 30, 2025 14:16
emako added a commit that referenced this pull request Aug 1, 2025
Use following option in `QuickLook.Plugin.ImageViewer.config` to fix the issue:
```xml
<?xml version="1.0" encoding="utf-8"?>
<Settings>
  <UseColorProfile>false</UseColorProfile>
  <UseNativeProvider>false</UseNativeProvider>
</Settings>
```
@emako
Copy link
Member

emako commented Aug 1, 2025

I fix it with 67b5dbf instead of your PR.

@emako emako closed this Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Color Management Issue: Quick Look Fails to Render Wide-Gamut Images Correctly

2 participants