[unrealenghine,photoshop]HDRは32bitなので16bitに変換しないとPNGに保存できない、8bitに変換しないと TGA に保存できない

Can Not HDR Traslate To TGA even if CopySave

 function step_8bit(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("hdrtype4"));
    desc2.putDouble(cTID('Rds '), 7.68);
    desc2.putDouble(cTID('Thsh'), 0.52959457138863);
    desc2.putDouble(cTID('Cntr'), 1);
    desc2.putDouble(cTID('Strt'), 20);
    desc2.putDouble(cTID('Dtl '), 30);
    desc2.putBoolean(cTID('Smoo'), false);
    var desc3 = new ActionDescriptor();
    desc3.putString(cTID('Nm  '), "初期設定");
    var list1 = new ActionList();
    var desc4 = new ActionDescriptor();
    desc4.putDouble(cTID('Hrzn'), 0);
    desc4.putDouble(cTID('Vrtc'), 0);
    list1.putObject(cTID('CrPt'), desc4);
    var desc5 = new ActionDescriptor();
    desc5.putDouble(cTID('Hrzn'), 255);
    desc5.putDouble(cTID('Vrtc'), 255);
    list1.putObject(cTID('CrPt'), desc5);
    desc3.putList(cTID('Crv '), list1);
    desc2.putObject(sTID("classFXShapeCurve"), cTID('ShpC'), desc3);
    desc2.putBoolean(sTID("deghosting"), false);
    desc1.putObject(cTID('With'), sTID("hdrOptions"), desc2);
    executeAction(sTID('convertMode'), desc1, dialogMode);
  };  

  //save TGA  (Can Not  HDR Traslate To TGA even if CopySave)
  function step4_save_tga(savePath){
  step_8bit();
  SaveOptions = new TargaSaveOptions();     
  TargaSaveOptions.alphaChannels = true; //include alpha channels, change to false for none    
  TargaSaveOptions.resolution = TargaBitsPerPixels.TWENTYFOUR; //options of SIXTEEN or THIRTYTWO 
  TargaSaveOptions.rleCompression = true; //false for no compression
  var saveFile = File(savePath); 
  app.activeDocument.saveAs(saveFile, TargaSaveOptions, true,Extension.LOWERCASE);      
  }; 

//---------------------------------------------------------------------------------
function step1_16bit(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("hdrtype4"));
    desc2.putDouble(cTID('Rds '), 7.68);
    desc2.putDouble(cTID('Thsh'), 0.52959457138863);
    desc2.putDouble(cTID('Cntr'), 1);
    desc2.putDouble(cTID('Strt'), 20);
    desc2.putDouble(cTID('Dtl '), 30);
    desc2.putBoolean(cTID('Smoo'), false);
    var desc3 = new ActionDescriptor();
    desc3.putString(cTID('Nm  '), "初期設定");
    var list1 = new ActionList();
    var desc4 = new ActionDescriptor();
    desc4.putDouble(cTID('Hrzn'), 0);
    desc4.putDouble(cTID('Vrtc'), 0);
    list1.putObject(cTID('CrPt'), desc4);
    var desc5 = new ActionDescriptor();
    desc5.putDouble(cTID('Hrzn'), 255);
    desc5.putDouble(cTID('Vrtc'), 255);
    list1.putObject(cTID('CrPt'), desc5);
    desc3.putList(cTID('Crv '), list1);
    desc2.putObject(sTID("classFXShapeCurve"), cTID('ShpC'), desc3);
    desc2.putBoolean(sTID("deghosting"), false);
    desc1.putObject(cTID('With'), sTID("hdrOptions"), desc2);
    executeAction(sTID('convertMode'), desc1, dialogMode);
  };

  //save Png 
  function step4_save(savePath,enabled, withDialog) {
  step1_16bit();
  var file_obj = new File(savePath);
  var png_opt = new PNGSaveOptions();
  png_opt.interlaced = false;
  var savedDisplayDialogs = app.displayDialogs;
  app.displayDialogs = DialogModes.NO;
  activeDoc=app.activeDocument;
  app.activeDocument.saveAs(file_obj, png_opt, true, Extension.LOWERCASE);
  
  }
//---------------------------------------------------------------------------------


  // save HDR (HDR to HDR)
  function step4_save(savePath,enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putString(cTID('As  '), "Radiance");
    desc1.putPath(cTID('In  '), new File(savePath));
    desc1.putInteger(cTID('DocI'), 70);
    desc1.putBoolean(cTID('LwCs'), true);
    executeAction(sTID('save'), desc1, dialogMode);
  };

参考

Targa形式で保存する

http://www.openspc2.org/book/PhotoshopCC2014/easy/save/010/index.html

関連記事

コメント

この記事へのコメントはありません。

TOP