UE4を使っていると2DデザイナーはPNGを使ってくるけども
PNGの透過はUE4では使えない。
だからTGAに変換します。どんなかんじにこんな感じに
PNGのアルファ反転してtga保存
#target photoshop
//
// PNG_AlphaChannelInverse__Go__TGA.jsx
//
//
// Generated Wed Feb 02 2022 12:59:51 GMT+0900
//
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
//
//==================== アルファ反転してtga保存 ==============
//
function ________tga() {
//
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putInteger(cTID('Dpth'), 8);
var desc2 = new ActionDescriptor();
desc2.putInteger(cTID('Vrsn'), 6);
desc2.putEnumerated(cTID('Mthd'), sTID("hdrToningMethodType"), sTID("hdrtype2"));
desc2.putDouble(cTID('Exps'), 0);
desc2.putDouble(cTID('Gmm '), 1);
desc2.putBoolean(sTID("deghosting"), false);
desc1.putObject(cTID('With'), sTID("hdrOptions"), desc2);
executeAction(sTID('convertMode'), desc1, dialogMode);
};
//
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName(cTID('Chnl'), "アルファチャンネル 1");
desc1.putReference(cTID('null'), ref1);
executeAction(sTID('select'), desc1, dialogMode);
};
//
function step3(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
executeAction(sTID('invert'), undefined, dialogMode);
};
//
function step4(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putInteger(cTID('BtDp'), 32);
desc2.putInteger(cTID('Cmpr'), 0);
desc1.putObject(cTID('As '), cTID('TrgF'), desc2);
desc1.putPath(cTID('In '), new File("ファイルパス"));
desc1.putInteger(cTID('DocI'), 223);
executeAction(sTID('save'), desc1, dialogMode);
};
step1(); //
step2(); //
step3(); //
step4(); //
};
//=========================================
// ________tga.main
//=========================================
//
________tga.main = function () {
________tga();
};
________tga.main();
// EOF
"PNG_AlphaChannelInverse__Go__TGA.jsx"
// EOF
TGA 透過は削除してPNGへ
#target photoshop
//
// AlphaChannelDelete_Go_TGA_PNG.jsx
//
//
// Generated Wed Feb 02 2022 12:58:24 GMT+0900
//
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
//
//==================== アルファチャンネルを無くしてPNG保存 ==============
//
function ______________PNG() {
//
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putInteger(cTID('Dpth'), 16);
var desc2 = new ActionDescriptor();
desc2.putInteger(cTID('Vrsn'), 6);
desc2.putEnumerated(cTID('Mthd'), sTID("hdrToningMethodType"), sTID("hdrtype2"));
desc2.putDouble(cTID('Exps'), 0);
desc2.putDouble(cTID('Gmm '), 1);
desc2.putBoolean(sTID("deghosting"), false);
desc1.putObject(cTID('With'), sTID("hdrOptions"), desc2);
executeAction(sTID('convertMode'), desc1, dialogMode);
};
//
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putEnumerated(cTID('Mthd'), sTID("PNGMethod"), sTID("quick"));
desc2.putEnumerated(sTID("PNGInterlaceType"), sTID("PNGInterlaceType"), sTID("PNGInterlaceNone"));
desc2.putEnumerated(sTID("PNGFilter"), sTID("PNGFilter"), sTID("PNGFilterAdaptive"));
desc2.putInteger(cTID('Cmpr'), 6);
desc1.putObject(cTID('As '), sTID("PNGFormat"), desc2);
desc1.putPath(cTID('In '), new File("ファイルパス"));
desc1.putInteger(cTID('DocI'), 314);
desc1.putBoolean(cTID('Cpy '), true);
desc1.putBoolean(cTID('AlpC'), false);
executeAction(sTID('save'), desc1, dialogMode);
};
//
function step3(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('Svng'), cTID('YsN '), cTID('N '));
desc1.putInteger(cTID('DocI'), 314);
desc1.putBoolean(sTID("forceNotify"), true);
executeAction(sTID('close'), desc1, dialogMode);
};
step1(); //
step2(); //
step3(); //
};
//=========================================
// ______________PNG.main
//=========================================
//
______________PNG.main = function () {
______________PNG();
};
______________PNG.main();
// EOF
"AlphaChannelDelete_Go_TGA_PNG.jsx"
// EOF
コメント