您当前的位置: 首页 > 

Photoshop插件-保存-8位通道-16位通道-脚本开发-PS插件

发布时间:2022-03-27 12:40:08 ,浏览量:7

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

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

2.关键代码 2.1.8位通道

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

ErrStrs = {}; ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=User cancelled the operation"); 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=The command is currently not available")); } } 
2.2.16位通道

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

ErrStrs = {}; ErrStrs.USER_CANCELLED = localize("$$$/ScriptingSupport/Error/UserCancelled=User cancelled the operation"); 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=The command is currently not available")); } } 
3.代码转执行

  使用记事本或者notepad++等文本编辑器,将代码拷贝至文本文件,然后修改后缀名为js或者jsx,最后再PS软件菜单文件》脚本》浏览,点执行即可,也可以将脚本放在预设文件夹内,会显示再脚本下的二级子菜单。如下图所示: 在这里插入图片描述

4.作者答疑

  如有疑问,请留言。

关注
打赏
1688896170
查看更多评论

暂无认证

  • 7浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0454s