나는이 문제로 여러 날 어려움을 겪었으므로 설명을 찾을 수 없습니다!프로파일을 모니터하기 위해 ProPhoto RGB에서 색상 변환
배경 :
나는 색상 VC9 + MFC와 Windows에서 사진 편집 응용 프로그램을 관리 생성 및 사진 포함 된 색상 프로파일의 픽셀을 변환하는 WCS (윈도우 컬러 시스템) API를 사용하고 있습니다 모니터의 프로파일에.
내 모니터가 "Windows 디스플레이 보정"으로 보정되었고 "CalibratedDisplayProfile-x.icc"라는 프로파일이 생성되었습니다.
는 문제 :
내가의 프로필을 모니터링하는 "하려면 [ProPhoto RGB"의 픽셀을 변환, 어두운 영역 변화의 색상, 색조는 녹색으로 바뀝니다. 목표 프로필이 sRGB 인 경우 중간 색조/하이라이트에서 발생하지 않습니다. 여기에 스크린 샷이 있습니다.
테스트 :
문제를 단순화하기 위해, 나는 하나의 색상을 변환하는 몇 가지 테스트 코드를 작성하지만, 테스트 결과는 정말 날 혼란 있습니다. 원본 색상 "c0"은 RGB (0,0,65535)이지만 출력 색상 "c1"은 RGB (0,0,0)입니다 !! 그리고 "CheckColor"기능이 "잘못된 인수"오류와 함께 실패합니다 ...
어떻게 될 수 있습니까? 내가 뭔가 잘못하고 있는거야?
현재 두 프로파일을 다운로드 할 수 있습니다 Color Profiles
감사합니다 아주 많이!
CString strProfilePath = _T("C:\\Windows\\System32\\spool\\drivers\\color\\");
CString strSrcProfile = strProfilePath + _T("ProPhoto.icm");
CString strDstProfile = strProfilePath + _T("CalibratedDisplayProfile-2.icc");
PROFILE pf = {0};
pf.dwType = PROFILE_FILENAME;
pf.pProfileData = (PVOID)strSrcProfile.GetBuffer();
pf.cbDataSize = (strSrcProfile.GetLength() + 1) * sizeof(TCHAR);
HPROFILE hSrcProfile = ::OpenColorProfile(&pf, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING);
pf.pProfileData = (PVOID)strDstProfile.GetBuffer();
pf.cbDataSize = (strDstProfile.GetLength() + 1) * sizeof(TCHAR);
HPROFILE hDstProfile = ::OpenColorProfile(&pf, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING);
HPROFILE hProfiles[2];
hProfiles[0] = hSrcProfile;
hProfiles[1] = hDstProfile;
DWORD dwIndents[2] = { INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC };
HTRANSFORM hTransform = ::CreateMultiProfileTransform(hProfiles, 2, dwIndents, 2, BEST_MODE, INDEX_DONT_CARE);
COLOR c0, c1;
c0.rgb.red = 0;
c0.rgb.green = 0;
c0.rgb.blue = 0xffff;
::TranslateColors(hTransform, &c0, 1, COLOR_RGB, &c1, COLOR_RGB);
BYTE btResult = 0;
::CheckColors(hTransform, &c0, 1, COLOR_RGB, &btResult);
::DeleteColorTransform(hTransform);
::CloseColorProfile(hSrcProfile);
::CloseColorProfile(hDstProfile);
지금 LittleCMS를 사용하고 있습니다. 훨씬 나아 졌어. –