I am trying to use ctypes to call windows api function to set color profile. According to the document, I have to first install color profile and then associate it to the monitor. In my case, I want to associate to the display 1. mscms.AssociateColorProfileWithDeviceW(None,profile_path,Device.DeviceName) return 0. I check the color management. the profile is not associated. Does someone know what's wrong here? Thanks!
here is the code:
import ctypes
from ctypes import wintypes
import win32api as w
import win32con as c
mscms = ctypes.CDLL("Mscms.dll")
profile_path = r'C:\Windows\System32\spool\drivers\color\test.icm'
#install profile
res = mscms.InstallColorProfileW(None,profile_path)
Device = w.EnumDisplayDevices(None,0,0)
associateProfile = mscms.AssociateColorProfileWithDeviceW(None,profile_path,Device.DeviceName)
print('associateProfile: ',associateProfile)
Perhaps this may be of some help, here is a list of functions you can use to manage color profiles.
Specifically, InstallProfileColorW might be what you're looking for.
I don't think this is currently supported in pywin32 and would require you to either use
ctypesorcffiyourself to create the particular bindings, or perhaps write a Python extension that does this for you.