View Full Version : ICCConvert - Little CMS based color management in VS
Yomiko
9th August 2021, 06:35
https://github.com/YomikoR/VapourSynth-ICCConvert
I ported some elementary features of Little CMS for color management in VapourSynth.
Features:
- Color profile conversion.
- Playback like in the mpv player (BT.1886 or overridden with a custom gamma).
- Extract color profile from image (when built with ImageMagick 7).
- Auto detection of the display color profile loaded for the current monitor, so that the plugin can be included in a Python wrapper for other users.
About auto profile detection:
- Since the main purpose of the plugin is QC, it's strongly recommended to manually specify the input for actual encoding.
- The detected window refers to the editor interface of VS Editor, or the console where you launch VS Preview, etc., NOT the preview windows of these editors.
- Windows: foreground window.
- Linux, X11: window of input focus. Recommended to build with colord support.
- Linux, Wayland: not yet implemented. Let's see if there will be a colord alternative for Wayland.
- MacOS: not yet implemented. Help wanted.
Help wanted:
- Correctness and auto profile detection in MacOS. I don't have a device.
Yomiko
1st September 2021, 10:56
Release 3.0 (https://github.com/YomikoR/VapourSynth-ICCConvert/releases/tag/3.0)
- Old function names are changed to "Convert" and "Playback", respectively.
- Added an "Extract" function that provides the embedded ICC profile of an input image with its default rendering intent.
Yomiko
19th September 2021, 16:37
Release 3.2 (https://github.com/YomikoR/VapourSynth-ICCConvert/releases/tag/3.2)
It has been a lot saner.
Now it can read embedded ICC profiles from the frame property "ICCProfile". Check the flag "prefer_props". These profiles are hashed so that duplication of them from frames won't cause a big performance loss.
This feature is only shipped with the new VS API.
Myrsloik
19th September 2021, 18:06
Unfortunately new imwri builds are taking a bit longer than expected due to imagemagick being horrible to compile/link with in windows. Will hopefully be fixed soon.
lansing
17th December 2021, 07:23
Test with a TIFF image scanned in 48 bit depth and with a "wide gamut RGB" ICC profile embedded, worked. Though the "gamut_warning" seems to not work? I have a sRGB monitor and some of the color on my image is definitely out of sRGB range, but with gamut_warning=True I did not see any indication on my image.
clip = core.imwri.Read(img, embed_icc=True)
clip = core.iccc.Convert(clip, gamut_warning=True)
clip.set_output()
Yomiko
17th December 2021, 10:08
Test with a TIFF image scanned in 48 bit depth and with a "wide gamut RGB" ICC profile embedded, worked. Though the "gamut_warning" seems to not work? I have a sRGB monitor and some of the color on my image is definitely out of sRGB range, but with gamut_warning=True I did not see any indication on my image.
clip = core.imwri.Read(img, embed_icc=True)
clip = core.iccc.Convert(clip, gamut_warning=True)
clip.set_output()
When my mind was broken I implemented the proofing transform for Convert. The proofing transform takes a backward step, which is required by the gamut warning. Now with the straight transform the flag is ignored.
I may correctly implement the proofing function in the future.
Yomiko
17th December 2021, 17:54
Release 4.0 (https://github.com/YomikoR/VapourSynth-ICCConvert/releases/tag/4.0)
Renamed "simulation_icc" to "input_icc".
Implemented soft proofing.
Yomiko
17th December 2021, 17:59
Test with a TIFF image scanned in 48 bit depth and with a "wide gamut RGB" ICC profile embedded, worked. Though the "gamut_warning" seems to not work? I have a sRGB monitor and some of the color on my image is definitely out of sRGB range, but with gamut_warning=True I did not see any indication on my image.
clip = core.imwri.Read(img, embed_icc=True)
clip = core.iccc.Convert(clip, gamut_warning=True)
clip.set_output()
Given an image (with its input_icc) and your monitor (with display_icc), now you may set proofing_icc as display_icc (sorry you have to type the path) for the gamut checking.
lansing
17th December 2021, 18:42
Given an image (with its input_icc) and your monitor (with display_icc), now you may set proofing_icc as display_icc (sorry you have to type the path) for the gamut checking.
Can you provide an example code to trigger the gamut warning? I'm confused with proofing_icc vs display_icc.
By guessing:
icc path = C:\Windows\System32\spool\drivers\color
input_icc = scanner's calibration icc
display_icc = sRGB icc
proofing_icc = WideGamutRGB icc
Is this correct?
Yomiko
18th December 2021, 02:02
Can you provide an example code to trigger the gamut warning? I'm confused with proofing_icc vs display_icc.
By guessing:
icc path = C:\Windows\System32\spool\drivers\color
input_icc = scanner's calibration icc
display_icc = sRGB icc
proofing_icc = WideGamutRGB icc
Is this correct?
input_icc: the (embedded) icc of the clip/image
display_icc: the monitor icc in spool
proofing_icc: for now let's suppose it's the icc of a printer
Soft proofing is for simulating how the image will be printed, while the result is shown on the monitor.
The printer may not reproduce all the colors of the image. This can be identified by the gamut checking.
In such situation, the rendering "intent" handles how colors are printed. The default value comes from the header of input_icc.
The monitor may not reproduce all the colors of the simulated printing result. This is not identified by the gamut checking.
In such situation, the rendering "proofing_intent" handles how the colors are shown on the monitor. The default value comes from the header of proofing_icc.
For your case it might be
input_icc from image,
display_icc from monitor,
proofing_icc from monitor (same as display_icc).
lansing
18th December 2021, 03:39
Thanks it worked. The warned area matched what I observed from photoshop's colorpicker.
srgb_icc = r'C:\Windows\System32\spool\drivers\color\sRGB.icc'
clip = core.imwri.Read(img, embed_icc=True)
clip = core.iccc.Convert(clip, proofing_intent="relative", display_icc=srgb_icc, proofing_icc=srgb_icc, gamut_warning=True)
clip.set_output()
https://i.imgur.com/PRmEEPy.jpg
What if I want to check if AdobeRGB color space is able to hold all the gamut of my scan instead of sRGB? Do I just change the proofing_icc to adobergb icc?
Yomiko
18th December 2021, 05:09
What if I want to check if AdobeRGB color space is able to hold all the gamut of my scan instead of sRGB? Do I just change the proofing_icc to adobergb icc?
Change both display_icc and proofing_icc to adobergb
lansing
18th December 2021, 06:50
Change both display_icc and proofing_icc to adobergb
Okay it worked. AdobeRGB was still not wide enough for the painting lol.
lansing
20th December 2021, 18:52
How do I keep the large gamut from the image in the output clip for future use like when I get a large gamut monitor? Do I set like display_icc=wide_gamut_rgb_icc and then convert the clip to rec2020?
Yomiko
21st December 2021, 00:48
There may be visible detail loss if you do so.
lansing
21st December 2021, 03:20
There may be visible detail loss if you do so.
How do I do it properly? From what I understand, imwri reads in the image data, but it needs embed_icc to turn on and the CMS filter to map the color correctly in video form. And since the Wide-Gamut-RGB color profile shared about the same gamut width as Rec2020, converting the RGB48 clip to Rec2020 would preserve all the gamut?
Yomiko
21st December 2021, 03:51
That's the right steps. But the problem is that the plugin is not sufficiently accurate. You may try converting forth and back and check the difference.
lansing
30th December 2021, 23:57
I have used the wrong rendering intent on my initial scan, and I don't want to rescan my image. Can I use this plugin to modify it in the input_icc and save it back to the image color profile?
Yomiko
31st December 2021, 06:08
Maybe, if you were using perceptual
lansing
31st December 2021, 06:35
I want to change from "perceptual" to "relative".
Yomiko
31st December 2021, 08:12
It should be perceptual, which behaves like an Expr. But tbh I didn't think much about it.
lansing
31st December 2021, 16:42
I was searching the internet for a last couple of days and couldn't find a solution, seems like there is no program currently that can modify the image's embedded color profile once it's created.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.