photoshopextendscriptphotoshop-script

activeDocument.bitsPerChannel = BitsPerChannelType.SIXTEEN; (WITHOUT MEREGER?) (Extendscript)


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.


Solution

  • 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 );