Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm looking for a way in Ubuntu to reduce the size of a pdf (by reducing the quality of the images).

I know that this can be done in Ghostscript by typing the following command in terminal:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

The problem is that I can't specify the quality with any accuracy. The parameter -dPDFSETTINGS=/screen is the one that decides the quality; but the alternatives are quite rigid (for example it is possible to do -dPDFSETTINGS=/ebook for slightly better quality).

I'm looking for a way to reduce the size of a pdf in a way that allows me to specify the desired quality numerically. I know that this is possible in a Mac, so it must be possible in Linux -- right?

Any help would be well appreciated.

share|improve this question
    
You might want to check this Q&A out. –  Glutanimate Apr 12 '13 at 0:51
add comment

1 Answer 1

These two posts that I had posted on Stackoverflow should help you. I was trying to reduce the size of pdfs whilst ensuring that they met a certain dpi or ppi for my thesis.

Reducing size of pdf with ghostscript

Changing pdf image dpi using gs

Have you tried playing around with convert in Linux?

Edit:

gs \
  -o out300.png \
  -sDEVICE=pngalpha \
  -r300 \
   input.pdf

If I remember correctly, r300 is the output dpi but you might want to check. This converts a pdf to a png, though.

OR

convert -units PixelsPerInch myPic.pdf -density 300 fileout.pdf

Let us know how it goes! This is for a pdf or any other format to any other format. I just used an input file of myPic.pdf and an output file of fileout.pdf

share|improve this answer
    
Hmm... I looked at the questions you linked to. They are interesting, but it is difficult to eke out a concrete command that I should use. I'm looking for a command with some numerical value there that I can play with that will determine the quality. Can you effect such a command? Can one do it using convert? –  Nicole Oct 28 '12 at 3:11
    
I editted my answer to include some more simpler options. Take a look and let us know! :) –  drN Oct 28 '12 at 13:10
    
The convert increases my pdf size, even if I use a 100 dpi. Maybe the best choice is to convert to png using "gs" and then "convert" to go to pdf? –  Nicole Oct 28 '12 at 19:15
    
@Nicole There have always been issues with pdf conversions. What do you propose to use the pdf for? –  drN Oct 28 '12 at 19:26
    
@Nicole I noticed that to get the best result for pdfs/eps files, I'd have to go back to the program that made the pdf in the first place and change my save options to save in the dpi/ppi that I want. I hope that helps and yes that can be a bit of a pain the backside. –  drN Oct 28 '12 at 19:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.