未定义的颜色配置文件

Undefined colour profile

本文关键字:配置文件 颜色 未定义      更新时间:2023-09-26

我正在尝试从文档中删除颜色配置文件。据我所知,colorProfileName应该是字符串或null(如果未分配)。但是,如果是后者,我就不能将其分配给一个变量(第3行)。

如果没有尝试/接球,有办法解决这个问题吗?

try {
    var cp = app.activeDocument.colorProfileName;
} catch(eek) {
    alert("no colour profile associated with image");
    cp = null;
}
if (cp != null) {
    cp = assignNoColourProfile(cp);
    if (cp == null) {
        alert("colour profile now removed");
    }
}

我只能访问Photoshop CS5,colorProfileName的描述是:

仅当colorProfileType=ColorProfile.CUSTOM或WORKING时有效。

所以,也许在之前检查一下是个好主意:

var cp = null;
if (app.activeDocument.colorProfileType != ColorProfile.NONE)
    cp = app.activeDocument.colorProfileName;

Michael/Hamburg