Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
Adobe photoshop - convert image to bitmap using a script

I'm trying to write a script in Photoshop using JavaScript. The goal for this script is to automatically convert from RGB to Bitmap mode. I don't want use the manual way: image->mode->greyscale->image->mode->bitmap.

After reading the “JavaScript Scripting Reference” I understand that I need to do it the same as the manual way but using code.

  1. I convert the RGB image to grayscale using the changeMode method. This works:

    app.activeDocument.changeMode(ChangeMode.GRAYSCALE)
    
  2. But, when I try to change from greyscale to bitmap I just can´t. The document does not explain clearly how it works. I did try to follow the document but I don't have a lot of experience in JavaScript.

    // Save the current preferences
    var startRulerUnits = app.preferences.rulerUnits
    var startTypeUnits = app.preferences.typeUnits
    var startDisplayDialogs = app.displayDialogs
    // Set Adobe Photoshop to use pixels and display no dialogs
    app.preferences.rulerUnits = Units.PIXELS
    app.preferences.typeUnits = TypeUnits.PIXELS
    app.displayDialogs = DialogModes.NO
    
    app.activeDocument.changeMode(ChangeMode.GRAYSCALE)
    app.activeDocument.changeMode(ChangeMode.Bitmap)
    // app.activeDocument.close()
    

I appreciate your help with providing a simple example about how to do it.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!