Skip to content

Instantly share code, notes, and snippets.

@ebta
Forked from anderflash/grayscale.sh
Last active November 22, 2020 14:45
Show Gist options
  • Save ebta/added97edc5980434301e0910e739a6a to your computer and use it in GitHub Desktop.
Save ebta/added97edc5980434301e0910e739a6a to your computer and use it in GitHub Desktop.
Convert PDF to Grayscale using ghostscript

Install ghostscript from yout terminal : sudo apt install ghostscript, then create file, for example pdf2gray.sh and copy paste the script bellow. Add execution access using chmod +x pdf2gray.sh

#!/bin/bash

gs \
 -sOutputFile=$2 \
 -sDEVICE=pdfwrite \
 -sColorConversionStrategy=Gray \
 -dProcessColorModel=/DeviceGray \
 -dCompatibilityLevel=1.4 \
 -dNOPAUSE \
 -dBATCH \
 $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment