Skip to main content
Known Participant
April 7, 2025
Question

New document defining bit depth

  • April 7, 2025
  • 1 reply
  • 274 views

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

1 reply

Stephen Marsh
Community Expert
Community Expert
April 7, 2025

@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

Known Participant
April 7, 2025

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

 

Stephen Marsh
Community Expert
Community Expert
April 8, 2025

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

 

Beyond DOM code, one could use AM code.