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

Is there a simple way to convert bit depth to 16 bit?

Enthusiast ,
Nov 07, 2014 Nov 07, 2014

Copy link to clipboard

Copied

It seems there are PDF/BITMAP specific methods to convert to 8 bit depth, but I can't find any documentation to do this easily to the file as a whole. Is there a way to do this? I want to convert from 32 to 16 bit.

TOPICS
Actions and scripting

Views

746

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

Advisor , Nov 08, 2014 Nov 08, 2014

I have code in Image Processor Pro that looks like this:

  // Bit Depth

  var bd = toNumber(task.@bitDepth) || 0;

  if (bd) {

    var bpc = doc.bitsPerChannel;

    try {

      if (bd == 8) {

        doc.bitsPerChannel = BitsPerChannelType.ONE;

      } else if (bd == 8) {

        doc.bitsPerChannel = BitsPerChannelType.EIGHT;

      } else if (bd == 16) {

        doc.bitsPerChannel = BitsPerChannelType.SIXTEEN;

      } else if (bd == 32) {

        doc.bitsPerChannel = BitsPerChannelType.THIRTYTWO;

...

Votes

Translate

Translate
Adobe
Advisor ,
Nov 08, 2014 Nov 08, 2014

Copy link to clipboard

Copied

I have code in Image Processor Pro that looks like this:

  // Bit Depth

  var bd = toNumber(task.@bitDepth) || 0;

  if (bd) {

    var bpc = doc.bitsPerChannel;

    try {

      if (bd == 8) {

        doc.bitsPerChannel = BitsPerChannelType.ONE;

      } else if (bd == 8) {

        doc.bitsPerChannel = BitsPerChannelType.EIGHT;

      } else if (bd == 16) {

        doc.bitsPerChannel = BitsPerChannelType.SIXTEEN;

      } else if (bd == 32) {

        doc.bitsPerChannel = BitsPerChannelType.THIRTYTWO;

      }

    } catch (e) {

      LogFile.logException(e, "Error selecting bit depth " + bd);

    }

  }

Then, later, I have this code which changes the document mode so that you can save it as a bmp file:

  if (ImageProcessorOptions.JDI && ext == "bmp") {
    // We need to make adjustments depending the number of
    // bmp save bits selected
    if (saveOpts.depth == BMPDepthType.ONE ||
        saveOpts.depth == BMPDepthType.SIXTEEN ||
        saveOpts.depth == BMPDepthType.TWENTYFOUR ||
        saveOpts.depth == BMPDepthType.THIRTYTWO) {
      saveOpts.rleCompression = false;
    }

    if (saveOpts.depth == BMPDepthType.FOUR ||
        saveOpts.depth == BMPDepthType.EIGHT) {
      doc.changeMode(ChangeMode.GRAYSCALE);
    }

    if (saveOpts.depth == BMPDepthType.ONE) {
      if (doc.mode != ChangeMode.BITMAP) {
        doc.changeMode(ChangeMode.GRAYSCALE);
      }
      var cnvtOpts = new BitmapConversionOptions();
      doc.changeMode(ChangeMode.BITMAP, cnvtOpts);
    }
  }

I don't think I've tested with pdfs files.

Hope this helps.

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
Enthusiast ,
Nov 08, 2014 Nov 08, 2014

Copy link to clipboard

Copied

LATEST

Thanks! I'm just working with Tifs, but I mentioned pdf, cause there's code on the save side to convert bit depth. As per usual, I probably had my syntax wrong, but his is exactly the method I was looking for! Thanks!

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