0
点赞
收藏
分享

微信扫一扫

Photoshop插件--RGB颜色--CMYK颜色--LAB颜色--脚本开发--PS插件

天天天蓝loveyou 2022-02-15 阅读 165

文章目录


  PS是一款栅格图像编辑软件,具有许多强大的功能,本文演示如何通过脚本切换RGB颜色,CMYK颜色,LAB颜色,展示从互联网收集而来的一个小插件,供大家学习交流,请勿用于商业用途。

1.插件界面

  本文界面是一系列功能的一部分,将逐步展示,但是功能界面是共同的,如下图所示:
在这里插入图片描述

2.关键代码

2.1RGB颜色

  大家可通过源代码阅读,来掌握相关技巧,源代码如下:

ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=用户取消了操作");
try {
    var idCnvM = charIDToTypeID('CnvM');
    var desc862 = new ActionDescriptor();
    var idTspspsp = charIDToTypeID('T   ');
    var idRGBM = charIDToTypeID('RGBM');
    desc862.putClass(idTspspsp, idRGBM);
    executeAction(idCnvM, desc862, DialogModes.ALL);
} catch (e) {
    if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
        ;
    } else {
        alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=该命令当前不可用"));
    }
}

2.2CMYK颜色

  大家可通过源代码阅读,来掌握相关技巧,源代码如下:

ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=用户取消了操作");
try {
    var idCnvM = charIDToTypeID('CnvM');
    var desc861 = new ActionDescriptor();
    var idTspspsp = charIDToTypeID('T   ');
    var idCMYM = charIDToTypeID('CMYM');
    desc861.putClass(idTspspsp, idCMYM);
    executeAction(idCnvM, desc861, DialogModes.ALL);
} catch (e) {
    if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
        ;
    } else {
        alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=该命令当前不可用"));
    }
}

2.3LAB颜色

  大家可通过源代码阅读,来掌握相关技巧,源代码如下:

ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=用户取消了操作");
try {
    var idCnvM = charIDToTypeID('CnvM');
    var desc860 = new ActionDescriptor();
    var idTspspsp = charIDToTypeID('T   ');
    var idLbCM = charIDToTypeID('LbCM');
    desc860.putClass(idTspspsp, idLbCM);
    executeAction(idCnvM, desc860, DialogModes.ALL);
} catch (e) {
    if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
        ;
    } else {
        alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=该命令当前不可用"));
    }
}

3.作者寄语

  合理的脚本代码可以有效的提高工作效率,减少重复劳动。

举报

相关推荐

0 条评论