私はこの問題に何日も苦労してきましたが、説明が見つかりません!
バックグラウンド:
VC9 + MFCを使用してWindowsでカラー管理された写真編集アプリを作成し、WCS(Windowsカラーシステム)APIを使用して、写真に埋め込まれたカラープロファイルからモニターのプロファイルにピクセルを変換しています。
私のモニターは「Windows Display Calibration」で調整され、「CalibratedDisplayProfile-x.icc」という名前のプロファイルが作成されました。
問題:
「ProPhoto RGB」からモニターのプロファイルにピクセルを変換すると、暗い領域の色がシフトし、色合いが緑色になります。ターゲット プロファイルが sRGB の場合、これはミッドトーン/ハイライトでは発生しません。ここにスクリーンショットがあります。
テスト:
問題を単純化するために、単一の色を変換するためのテスト コードをいくつか書きましたが、テスト結果は本当に混乱を招きます。ソースカラー "c0" はRGB(0,0,65535)ですが、出力カラー "c1" はRGB(0,0,0)です!! 関数「CheckColor」は「引数が無効です」というエラーで失敗します...
これはどのように起こりますか?私は何か間違ったことをしていますか?
ここから 2 つのプロファイルをダウンロードできます:カラー プロファイル
どうもありがとう!
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 );