Skip to main content
Known Participant
Apr 7, 2025 1:41 PM UTC
Question

New document defining bit depth

Hi

I'm trying to script the creation of a document and defining the bit depth based on a tick box in my UI however i keep getting en error

 

BitsPerChannelType.EIGHT

BitsPerChannelType.SIXTEEN

BitsPerChannelType.THIRTYTWO

 

all give me the same error, does this element just not work from the dom?

app.documents.add(
    1920, // Width
    1080, // Height
    72, // Resolution
    "Test Document", // Name
    NewDocumentMode.RGB, // Mode
    BitsPerChannelType.THIRTYTWO // Bit Depth
);

3 replies

Stephen Marsh
Community Expert
Community Expert
Apr 7, 2025 2:16 PM UTC

@jackdaw_1066 

 

Pick this apart:

 

app.documents.add(UnitValue(800, "px"), // width
    UnitValue(600, "px"), // height
    72, // resolution
    "test", // name
    NewDocumentMode.RGB, // mode
    DocumentFill.WHITE, // initialFill
    1, // pixelAspectRatio
    BitsPerChannelType.THIRTYTWO, // bitsPerChannel
    "sRGB IEC61966-2.1"); // colorProfileName

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/Documents/add.html#documents-add

Translate
Known Participant
Apr 7, 2025 2:58 PM UTC

Hi thanks for getting back to me
Im new to scripting so still trying to get my head around it all, i found the website you shared too but i still can't impliment it.

I tried running your code and it fails

 

Translate
Stephen Marsh
Community Expert
Community Expert
Apr 8, 2025 2:47 PM UTC

Strange, the code worked fine for me which is why I posted it.

 

Beyond DOM code, one could use AM code.

Translate