Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How To Get Active Document Bit Depth

Contributor ,
Jul 29, 2017 Jul 29, 2017

Can someone demonstrate with Javascript how I can run a block of code depending on what the active document bit depth is

If activeDocument.bitsPerChannel is 16 then (run this code)

if activeDocument.bitsPerChannel is 8 then (run this code)

if activeDocument.bitsPerChannel is not any of above (run this code)

Ian

TOPICS
Actions and scripting
852
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Jul 29, 2017 Jul 29, 2017

Like this:

var doc = app.activeDocument;

var bpc = doc.bitsPerChannel;

if (bpc === BitsPerChannelType.EIGHT) {

    // do something here

} else if (bpc === BitsPerChannelType.SIXTEEN) {

    // do something here

} else if (bpc === BitsPerChannelType.THIRTYTWO) {

    // do something here

}

Translate
Adobe
Advocate ,
Jul 29, 2017 Jul 29, 2017

Like this:

var doc = app.activeDocument;

var bpc = doc.bitsPerChannel;

if (bpc === BitsPerChannelType.EIGHT) {

    // do something here

} else if (bpc === BitsPerChannelType.SIXTEEN) {

    // do something here

} else if (bpc === BitsPerChannelType.THIRTYTWO) {

    // do something here

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 29, 2017 Jul 29, 2017
LATEST

Thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines