Reputation: 69
I really hope the someone can help out. I just need to change depth from 32 to 16 bit without merging the layers. The code for changing depth is as follows:
activeDocument.bitsPerChannel = BitsPerChannelType.SIXTEEN;
However, it flattens the image (merges all layers).
I tried:
BitsPerChannelType.SIXTEEN.WITOUTMERGER;
BitsPerChannelType.SIXTEEN.WithoutMerger;
But it didn’t work. I can of course call an action from the script like I do to apply exposure adjustment layer app.doAction ("Exposure", "Processing");
. But I want to know how.
Upvotes: 1
Views: 67
Reputation: 69
Implemented:
function exeAction (Type, subType, Value) {
if (Type == 'Mode') {
var desc27 = new ActionDescriptor();
var idCnvM = charIDToTypeID ('CnvM');
var idMrge = charIDToTypeID ('Mrge');
desc27.putBoolean (idMrge, false);
if (subType == 'Depth') {
var idDpth = charIDToTypeID ('Dpth');
desc27.putInteger (idDpth, Value);}
else if (subType == 'Color') {}
executeAction (idCnvM, desc27, DialogModes.NO);}
}
I tested and it works like a charm. I just need to add the rest of the IDcodes. I found this page Photoshop Scripting & Extension Reference which has become more useful than the Object Mode Viewer. I also found the Photoshop Javascript Ref 2020 however neither Dpth
nor Mrge
are listed under the Appendix A. Nevertheless, I also discovered the ScriptingListener plug-in.
Upvotes: 0
Reputation: 6967
To convert from 32 bit to 16 without merging use:
var idCnvM = charIDToTypeID( "CnvM" );
var desc27 = new ActionDescriptor();
var idDpth = charIDToTypeID( "Dpth" );
desc27.putInteger( idDpth, 16 );
var idMrge = charIDToTypeID( "Mrge" );
desc27.putBoolean( idMrge, false );
executeAction( idCnvM, desc27, DialogModes.NO );
Upvotes: 2