您当前的位置: 首页 > 

插件开发

暂无认证

  • 6浏览

    0关注

    492博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Photoshop插件--灰度--8位通道--16位通道--脚本开发--PS插件

插件开发 发布时间:2022-02-24 19:21:29 ,浏览量:6

文章目录
    • 1.插件界面
    • 2.关键代码
      • 2.1 灰度
      • 2.2 8位通道
      • 2.3 16位通道
    • 3.作者寄语
  PS是一款栅格图像编辑软件,具有许多强大的功能,本文演示如何通过脚本实现灰度,8位通道和16位通道相关功能,展示从互联网收集而来的一个小插件,供大家学习交流,请勿用于商业用途。

1.插件界面

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

2.关键代码 2.1 灰度

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

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

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

ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=用户取消了操作");
try {
    var idCnvM = charIDToTypeID('CnvM');
    var desc858 = new ActionDescriptor();
    var idDpth = charIDToTypeID('Dpth');
    desc858.putInteger(idDpth, 8);
    executeAction(idCnvM, desc858, DialogModes.ALL);
} catch (e) {
    if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
        ;
    } else {
        alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=该命令当前不可用"));
    }
}
2.3 16位通道

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

ErrStrs = {};
ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=用户取消了操作");
try {
    var idCnvM = charIDToTypeID('CnvM');
    var desc857 = new ActionDescriptor();
    var idDpth = charIDToTypeID('Dpth');
    desc857.putInteger(idDpth, 16);
    executeAction(idCnvM, desc857, DialogModes.ALL);
} catch (e) {
    if (e.toString().indexOf(ErrStrs.USER_CANCELLED) != -1) {
        ;
    } else {
        alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=该命令当前不可用"));
    }
}
3.作者寄语

文章引用至 作者知了-联系方式1

文章引用至 作者知了-联系方式2

关注
打赏
1665481431
查看更多评论
立即登录/注册

微信扫码登录

0.0393s