- UID
- 16611
- 阅读权限
- 20
- 注册时间
- 2007-12-15
- 最后登录
- 2020-1-28
- 在线时间
- 33 小时
- 性别
- 保密
骑士
- 耕战
- 1
- 鹰币
- 205
- 天龙币
- 0
- 回帖
- 10
|
发表于 2020-1-27 20:53:43
|
显示全部楼层
本帖最后由 leejuly29 于 2020-1-27 20:55 编辑
一個一個轉實在太麻煩,寫了一個指令碼,可以直接利用 photoshop 的指令碼功能讀取文件夾內的DDS檔自動對調通道存成 png
- #target Photoshop
- app.bringToFront();
- var doc;
- // DDS文件路徑
- var $inputFolder = new Folder("E:/SteamLibrary/steamapps/common/AoE2DE/widgetui/textures/ingame/units");
- var $fileList = $inputFolder.getFiles("*.DDS");
- var $pegOptions = new PNGSaveOptions();
- $pegOptions.compression = 1;
- for (var i = 0; i < $fileList.length; i++) {
- if ($fileList[i] instanceof File) {
- open($fileList[i]);
- doc = app.activeDocument;
- startTask ();
- // 預設輸出入徑是放在 output 資料夾下,要自行創建否則會提示錯誤
- doc.saveAs(new File($inputFolder + "/output/"+ $fileList[i].name + ".png"), $pegOptions, true);
- doc.close(SaveOptions.DONOTSAVECHANGES)
- }
- }
- function startTask () {
- var $channels = doc.channels;
- var $red = $channels[0];
- var $green = $channels[1];
- var $blue = $channels[2];
- doc.selection.selectAll();
- doc.activeChannels = [$red];
- doc.activeLayer.copy();
- var $blue_dup = $blue.duplicate();
- doc.activeChannels = [$blue];
- doc.paste ();
- doc.activeChannels = [$blue_dup];
- doc.activeLayer.copy();
- doc.activeChannels = [$red];
- doc.paste ();
- $blue_dup.remove();
- doc.activeChannels = [$red, $green, $blue];
- }
复制代码
使用方式:
創建文件副檔名存成 jsx
將指令碼複製進去(記得改DDS存放入徑,輸出入徑預設放在輸入路徑的output資料夾,記得先創建好)
將檔案丟到PS的指令碼資料夾 (Program Files/Adobe/Adobe Photoshop xxx/Presets/Scripts
打開 PS 便會在 檔案->指令碼的地方看到剛剛加入的指令碼,點選可執行
|
|