Copy link to clipboard
Copied
This is a long shot... might be better to ask in a game developer forum... but maybe someone knows how to do this. I have found lots of examples of using scripting to export images using Photoshop's built-in image types - but what if I want to save an image using a plugin - like the NVIDIA Texture Tools plugin.
My goal is to take an image I am working on, and have the script split it into a 4x4 grid of smaller images (so original image is cut up into 16 smaller images) - and save each grid image using specific settings for the NVIDIA Texture Tools plugin. Ideally, it would have a small gui for specifying the a naming convention - but even if it just saved images as 1.dds, 2.dds,....16.dds - that would be fine.
This has to be possible... Certainly game studios are doing this on a daily basis?
The splitting of the main image into smaller images I think I have a strategy... but I haven't found any documentation on the exposed scripting parameters of the NVIDIA plugin - or found any documentation on a way to use the scripting engine to query a plugin for its available options.
Any advice is much appreciated.
Thanks!
1 Correct answer
ScriptListener will do the job...
You will get something like this...
var idsave = charIDToTypeID( "save" );
var desc24 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
var desc25 = new ActionDescriptor();
var idsFoI = charIDToTypeID( "sFoI" );
desc25.putInteger( idsFoI, 0 );
var idsASC = charIDToTypeID( "sASC" );
desc25.putInteger( idsASC, 0 );
var idsTxT = charIDToTypeID( "sTxT" );
var idenTT = charIDToTypeID( "enTT"
...
Explore related tutorials & articles
Copy link to clipboard
Copied
I tried to download NVIDIA Texture Tools Exporter, however, it requires me to jump through a registration hoop, which I am not willing to do.
NVIDIA may have allowed Actions to record specific parameters, so try using the save as step in an action and see if it records the various options.
You may need to look into scripting, installing the Scripting Listener plugin and looking at what is recorded when saving an image using various options:
https://blogs.adobe.com/crawlspace/2006/05/installing_and_1.html
Copy link to clipboard
Copied
ScriptListener will do the job...
You will get something like this...
var idsave = charIDToTypeID( "save" );
var desc24 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
var desc25 = new ActionDescriptor();
var idsFoI = charIDToTypeID( "sFoI" );
desc25.putInteger( idsFoI, 0 );
var idsASC = charIDToTypeID( "sASC" );
desc25.putInteger( idsASC, 0 );
var idsTxT = charIDToTypeID( "sTxT" );
var idenTT = charIDToTypeID( "enTT" );
var idtxtwoD = charIDToTypeID( "tx2D" );
desc25.putEnumerated( idsTxT, idenTT, idtxtwoD );
var idmipF = charIDToTypeID( "mipF" );
desc25.putBoolean( idmipF, true );
var idmpFT = charIDToTypeID( "mpFT" );
desc25.putInteger( idmpFT, 0 );
var idmOFW = charIDToTypeID( "mOFW" );
desc25.putBoolean( idmOFW, false );
var idmFOV = charIDToTypeID( "mFOV" );
desc25.putDouble( idmFOV, 2.000000 );
var idmpPA = charIDToTypeID( "mpPA" );
desc25.putBoolean( idmpPA, true );
var idiOOM = charIDToTypeID( "iOOM" );
var ideIOM = charIDToTypeID( "eIOM" );
var ideICo = charIDToTypeID( "eICo" );
desc25.putEnumerated( idiOOM, ideIOM, ideICo );
var idiOBS = charIDToTypeID( "iOBS" );
desc25.putBoolean( idiOBS, false );
var idiOBr = charIDToTypeID( "iOBr" );
desc25.putDouble( idiOBr, 0.000000 );
var idiOBg = charIDToTypeID( "iOBg" );
desc25.putDouble( idiOBg, 0.000000 );
var idiOBb = charIDToTypeID( "iOBb" );
desc25.putDouble( idiOBb, 0.000000 );
var idiOBa = charIDToTypeID( "iOBa" );
desc25.putDouble( idiOBa, 1.000000 );
var idiOCQ = charIDToTypeID( "iOCQ" );
desc25.putInteger( idiOCQ, 0 );
var idiOSr = charIDToTypeID( "iOSr" );
desc25.putDouble( idiOSr, 1.000000 );
var idiOSg = charIDToTypeID( "iOSg" );
desc25.putDouble( idiOSg, 1.000000 );
var idiOSb = charIDToTypeID( "iOSb" );
desc25.putDouble( idiOSb, 1.000000 );
var idiOSa = charIDToTypeID( "iOSa" );
desc25.putDouble( idiOSa, 1.000000 );
var idiBir = charIDToTypeID( "iBir" );
desc25.putDouble( idiBir, 0.000000 );
var idiBig = charIDToTypeID( "iBig" );
desc25.putDouble( idiBig, 0.000000 );
var idiBib = charIDToTypeID( "iBib" );
desc25.putDouble( idiBib, 0.000000 );
var idiBia = charIDToTypeID( "iBia" );
desc25.putDouble( idiBia, 0.000000 );
var idiOWr = charIDToTypeID( "iOWr" );
desc25.putBoolean( idiOWr, false );
var idiOAZ = charIDToTypeID( "iOAZ" );
desc25.putBoolean( idiOAZ, false );
var idiOBA = charIDToTypeID( "iOBA" );
desc25.putBoolean( idiOBA, false );
var idiOSu = charIDToTypeID( "iOSu" );
desc25.putBoolean( idiOSu, false );
var idiOBT = charIDToTypeID( "iOBT" );
desc25.putInteger( idiOBT, 127 );
var idiOBD = charIDToTypeID( "iOBD" );
desc25.putBoolean( idiOBD, false );
var idiOPA = charIDToTypeID( "iOPA" );
desc25.putBoolean( idiOPA, false );
var idiOonezero = charIDToTypeID( "iO10" );
desc25.putBoolean( idiOonezero, false );
var idnFTy = charIDToTypeID( "nFTy" );
desc25.putInteger( idnFTy, 5 );
var idnWrp = charIDToTypeID( "nWrp" );
desc25.putBoolean( idnWrp, true );
var idnIvX = charIDToTypeID( "nIvX" );
desc25.putBoolean( idnIvX, false );
var idnIvY = charIDToTypeID( "nIvY" );
desc25.putBoolean( idnIvY, false );
var idnMnZ = charIDToTypeID( "nMnZ" );
desc25.putDouble( idnMnZ, 0.000000 );
var idnNSc = charIDToTypeID( "nNSc" );
desc25.putDouble( idnNSc, 1.000000 );
var idnCSr = charIDToTypeID( "nCSr" );
desc25.putInteger( idnCSr, 1 );
var idnAFi = charIDToTypeID( "nAFi" );
desc25.putInteger( idnAFi, 0 );
var idnNNl = charIDToTypeID( "nNNl" );
desc25.putBoolean( idnNNl, true );
var idnNCF = charIDToTypeID( "nNCF" );
var idenCD = charIDToTypeID( "enCD" );
var idecnZ = charIDToTypeID( "ecnZ" );
desc25.putEnumerated( idnNCF, idenCD, idecnZ );
var idnNCU = charIDToTypeID( "nNCU" );
var idenCD = charIDToTypeID( "enCD" );
var idecpY = charIDToTypeID( "ecpY" );
desc25.putEnumerated( idnNCU, idenCD, idecpY );
var idnNCR = charIDToTypeID( "nNCR" );
var idenCD = charIDToTypeID( "enCD" );
var idecpX = charIDToTypeID( "ecpX" );
desc25.putEnumerated( idnNCR, idenCD, idecpX );
var idiOFV = charIDToTypeID( "iOFV" );
desc25.putBoolean( idiOFV, false );
var idfxSt = charIDToTypeID( "fxSt" );
desc25.putString( idfxSt, """1 15 60 1 """ );
var idsirV = charIDToTypeID( "sirV" );
desc25.putInteger( idsirV, 1 );
var idNVIDIADDSNVIDIATextureToolsExporter = stringIDToTypeID( "NVIDIA DDS - NVIDIA Texture Tools Exporter" );
desc24.putObject( idAs, idNVIDIADDSNVIDIATextureToolsExporter, desc25 );
var idIn = charIDToTypeID( "In " );
desc24.putPath( idIn, new File( "C:\\DSC01895-2.dds" ) );
var idDocI = charIDToTypeID( "DocI" );
desc24.putInteger( idDocI, 315 );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc24.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc24, DialogModes.NO );

