Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.

Convert a PDF to greyscale on the command line in FLOSS?
I have a colour PDF file, and I'm going to print it out and then photocopy it in black and white. I'd like to know what it's like in B&W before photocopying it. Is it possible to 'greyscale' a PDF on the command line using free software? I'm using Ubuntu 9.10.
- command-line
3 Answers 3
ImageMagick can do this.
via this email
- 38 That significantly reduces quality. @goyinux' solution is better. – Johannes Weiss Feb 12, 2013 at 16:41
- 8 Convert will actually rasterize the contents of the pdf. So unless the pdf already encapsulates only raster images (e.g. a scanned document), this approach is a big no-no. – m000 Sep 19, 2014 at 12:24
- 4 Unless you use -density 400 -quality 100 parameters - that works well – burtek Dec 13, 2015 at 20:51
- 2 Really, is there anything ImageMagick can't do? :) – Joshua Grosso Reinstate CMs Aug 18, 2017 at 3:02
- 1 -density 400 -quality 100 creates HUGE files. +1 for @goyinux's solution. – Stanimir Stoyanov Jun 27, 2018 at 10:45
- 2 Agreed, this gives much better results than convert, but sometimes it rotates the pdf which is a bit annoying! – tdc Aug 7, 2012 at 18:08
- 21 Just realised you can disable that with -dAutoRotatePages=/None – tdc Aug 7, 2012 at 18:15
- 2 I just ran this command on a 58MB PDF that was already greyscale (came from a scanner) and the resulting output was 10MB and looked exactly the same. Nice! – Archie Dec 19, 2012 at 2:33
- 1 Works well on Windows, too! Just remove the `\` and put everything on the same line. – ixe013 Aug 19, 2014 at 4:23
- 1 In fact, this fails with this error GPL Ghostscript 9.10: Unable to convert color space to Gray, reverting strategy to LeaveColorUnchanged. – jjmerelo Dec 15, 2015 at 17:56
Here’s a little script which in addition to the grayscale conversion can concatenate multiple input files. To use the script, put the following lines in a file, e.g. "convert2gray.sh"
and make it executable
will produce a single PDF "converted.pdf", which contains all pages from the input files converted to grayscale.
I had to print out mutliple files all in grayscale and found this the easiest way, since you can print out everything after inpection with one command.
- FWIW, pdftk can concatenate PDFs, too. – user1338062 Jun 14, 2018 at 7:07
You must log in to answer this question.
Not the answer you're looking for browse other questions tagged linux ubuntu command-line pdf ..
- The Overflow Blog
- Wondering how sustainable your buildings are? Make your data speak sponsored post
- Meetings are the worst. Let's reduce their blast radius
Hot Network Questions
- Impossibility of trisecting the 60° angle using only a straightedge and compass
- Diagonal Binary Sequence
- Can I shove a creature away from me in a particular direction?
- Why are jurors asked if each element of a crime is proved, rather than the crime as a whole
- Can I create two or three more cutouts in my 6' Load Bearing Knee wall to build a closet System
- Who is the Israeli official that said that Gaza would be reduced to “a city of tents”?
- Source of a Poincaré quote: "Logic sometimes makes monsters..."
- Do larger rockets tend to have a better mass ratio due to the square cube law?
- Why do electrons not remain at higher energy levels?
- Do the military really use GA planes as target practice?
- When was the last direct conflict within Israel's boundaries?
- How to avoid having a higher total effort after delegating tasks to the team
- The slang term for books made of paper
- If any "antenna" can be impedance matched to the source, can any piece of metal be tuned to perform the same as a physically tuned antenna?
- Find all the real money
- What's the deal with Tek Knight's adaptation from "The Boys" comic book series into "Gen V"?
- Confusion about the conservation of momentum of a ball and an angled wall
- What happened to my car
- Adding direction arrows to discrete plot
- When to add 'de' after a noun when describing the noun
- What is the term for the little viewing window with a sliding cover in a castle or convent?
- How to count when bass and treble clefs share notes or chords
- Do Starfleet officers get to go on leave during times of war?
- Can I expense guest amenities for my AirBnB?
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
Instantly share code, notes, and snippets.

bzxbot / Convert a PDF file to black and white (not grayscale)
- Star 5 You must be signed in to star a gist
- Fork 1 You must be signed in to fork a gist
404 Not found
404 Not found
Convert PDF to black and white
Choose files.
Maximum combined file size: 100MB, up to 50 files Supported types: PDF, DOC, DOCX, ODT, PPT, PPTX (all files will be converted to PDF automatically)
PDF to grayscale (b/w) converter
Free online tool for converting color PDF to black and white (grayscale). Upload PDF document and click convert.

IMAGES
VIDEO
COMMENTS
Converting a PDF to black & white with ghostscript Asked 12 years, 11 months ago Modified 10 months ago Viewed 48k times 26 Similarly to this question: Convert a PDF to greyscale on the command line in FLOSS? I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones.
1 Answer Sorted by: 2 Essentially, you can't (or at least not using Ghostscript). Firstly you seem to be assuming that the colours will be specified in RGB when in fact they could be specified in CMYK, ICC, CalRGB or Lab. You also need to consider Indexed colour spaces.
1. Overview The ability to manipulate and edit PDF files has become essential for professionals across various industries. Creating a black-and-white PDF file is essential for printing or reading on devices with limited color capabilities.
13 My OS is Ubuntu 12.04. How can I convert a pdf file from gray-scale to black-white? The gray-scale pdf file comes from scanning with gray-scale option, and the black-white scale pdf is required by OCR. Update: Following Marco's reply, the B-W pdf isn't good and the original file is here. command-line pdf Share Improve this question
I also had some scanned color pdfs and grayscale pdfs that I wanted to convert to bw. I tried using gs with the code listed here, and image quality is good with pdf text still there.However, that gs code only converts to grayscale (as asked in the question) and still has large file size.
STEP 1 (for pdf editing) -. the first thing you need is to find the right equivalence between RGB color values of text and background and the internal pdf represerntation of same colors. you can use a free color pickers like these. to identify the rgb values of text and background colors.
3 Answers Sorted by: 40 ImageMagick can do this. convert -colorspace GRAY color.pdf gray.pdf via this email Share Improve this answer Follow answered Feb 4, 2010 at 11:20 Iain 4,728 2 27 41 38 That significantly reduces quality. @goyinux' solution is better. - Johannes Weiss Feb 12, 2013 at 16:41 8
Similarly on this question: Convert a PDF in greyscale on the command line in FLOSS? I have a PDF-document and want to convert items to pure black and white. So I want to discard halftones. In con...
1.34K subscribers Subscribe 4 429 views 1 year ago Linux Tutorial Become my channel member: https://www.sparxsys.com/join I am sure once in your life you had to convert a PDF file from colour...
Convert a PDF file to black and white (not grayscale) # The first approach that I found was to convert using a virtual device using Ghostscript. # The virtual device, pdfwrite, supports parameters to convert the original PDF file to another PDF file in grayscale. # In my case, I wanted only black and white, so this was not enough. #!/bin/bash.
Stack Exchange network comprise starting 183 Q&A communities inclusive Stacked Overflow, the largest, most trusted online community for our to learn, share their knowledge, and build own careers.. Go Stack Tauschen
Converting a PDF to black & white with ghostscriptHelpful? Please support me on Patreon: https://www.patreon.com/roelvandepaarWith thanks & praise to God, a...
1 I'm still trying to convert an RGB-pdf to an CMYK-pdf using PSOcoated_v3.icc as outputProfile (see my earlier question ). I'm convinced now that ghostscript treats the profile like lcms2 does (and apparently also Photoshop).
I'm trying to convert to grayscale on PDF: https://dl.dropboxusercontent.com/u/10351891/page-27.pdf Ghostscript (v 9.10) with pdfwrite Device fails with one "Unable ...
1 Answer Sorted by: 2 Option 1: convert -monochrome in.pdf out.pdf Option 2: You can still download Ghostscript 9.07 https://ghostscript.com/Ghostscript_9.07.html Compile it from source and make install the result. In v9.07 the psmono output device still works.
Choose files Maximum combined file size: 100MB, up to 50 files Supported types: PDF, DOC, DOCX, ODT, PPT, PPTX (all files will be converted to PDF automatically) PDF to grayscale (b/w) converter Free online tool for converting color PDF to black and white (grayscale). Upload PDF document and click convert.
printed to PostScript by MS PS Driver. converted to PDF by GhostScript. On the color issue, I am using the Microsoft PS Class Driver to print documents to PostScript format files, and then convert them to PDF format with the GhostScript v9.20 DLL (sample source and outputs attached above). The options used are as follows: