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

How To Get Active Document Bit Depth

Participant ,
Jul 29, 2017 Jul 29, 2017

Copy link to clipboard

Copied

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

Views

625

Translate

Translate

Report

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

}

Votes

Translate

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

Copy link to clipboard

Copied

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

}

Votes

Translate

Translate

Report

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
Participant ,
Jul 29, 2017 Jul 29, 2017

Copy link to clipboard

Copied

LATEST

Thank you

Votes

Translate

Translate

Report

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