0

For printing scanned graphics to PDF, I currently use CutePDF Writer. According to pdfimages, in the generated PDFs it embeds:

  • Black and white images (1 bit) as: losslessly compressed

  • Grayscale images (8 bit) as: losslessly compressed

  • True color images (24 bit) as: JPEG

The result is that grayscale documents are often larger than their color counterparts.

Is it possible to make CutePDF embed grayscale images as JPEG images?

Ideally, there also is an option to configure compression ratio.

Update

Following the suggestion by @Rik, I edited %programfiles%\Acro Software\CutePDF Writer\PDFWrite.rsp. My settings:

-sDEVICE=pdfwrite
-q
-dAutoRotatePages=/All
-dCompatibilityLevel=1.4
-dNOPAUSE
-dBATCH
-dMonoImageFilter=/FlateEncode
-dEncodeMonoImages=true
-dGrayImageFilter=/DCTEncode
-dEncodeGrayImages=true
-dColorImageFilter=/DCTEncode
-dEncodeColorImages=true

File size of my test PDF is now about half compared to before, and according to Xara Xtreme 5.1, the images are now embedded a JPEG (DCTEncode), while before they were embedded with lossless compression (FlateEncode). Strangely, pdfimages still extracts them as ppm despite the -j switch.

I also upgraded to the latest CutePDF Writer, and to Ghostscript 9.10.

And, very important, when printing, I have to select: print as PDF Otherwise, I would again get the lossless encoding (I don't understand why).

feklee
  • 1,604
  • 8
  • 22
  • 39
  • Why the close votes? I am asking this as an end user of Windows XP. – feklee Oct 21 '13 at 16:00
  • Questions that require product/software recommendations are considered off-topic, see help center and especially http://meta.superuser.com/questions/5372/how-do-i-ask-a-question-that-may-require-recommending-software how to improve your question. – mpy Oct 21 '13 at 19:33
  • @mpy Edited. Now my question is targeted specifically at CutePDF, see also the `cutepdf` tag. – feklee Oct 21 '13 at 19:47
  • Thanks, your questions looks fine to me now, so I retracted my close vote. – mpy Oct 21 '13 at 19:49
  • You have to "*print as PDF*"? From what program do you print? – Rik Oct 22 '13 at 08:10
  • @Rik: It's Presto! PageManager 4.20.08, admittedly an old piece of software, but it does the trick, and work flow is fast. – feklee Oct 22 '13 at 08:13
  • Among all the trial prints I made yesterday, I remember there was one PDF where a small grayscale image was embedded with lossless compression while another larger image was JPEG compressed. That could be the explanation. Thanks, @Rik – feklee Oct 22 '13 at 08:21
  • 1
    I read conflicting explanations about `-dAutoFilterGrayImages=xxx` so you could try them both (`true` and `false`). – Rik Oct 22 '13 at 08:23

1 Answers1

1

According to the help of CutePDF you can set the options in the following file:
%Program Files%\Acro Software\CutePDF Writer\PDFWrite.rsp


This is for adjusting the overall print-quality:

How to reduce the size of output PDF file?
You can alter the parameters used in a text file %Program Files%\Acro Software\CutePDF Writer\PDFWrite.rsp. The key parameters are in the line:

-dPDFSETTINGS=configuration

where configuration can be /screen, /printer, /prepress, /default. Using /Printer can cut size by half. You may get more info at here.


The problem with CutePdf is that you can't set these options for compression etc in a GUI. (e.g. with PDFCreator you can do this) You need to set it in PDFWrite.rsp.

In the PDFWrite.rsp you can set all the options you would for Ghostscript (which CutePDF uses for creation of the PDF). There are a lot of options for compression and downscaling etc. You can find the options here.

For example:

-dGrayImageDownsampleType=/Average 
-dGrayImageResolution=72
-dEncodeGrayImages=true
-dAutoFilterGrayImages=true

You need to find out what the best settings for your documents are.

Just for your reference: PDFCreator uses the following standard options. Maybe some of these options are a better fit then what CutePDF gives you (you need to try which ones): (Or you could try PDFCreator for yourself if it does a better job). PS. Always make sure to deselect any third-party software during install of free software (if you don't want them).

-q
-dNOPAUSE
-dBATCH
-sFONTPATH=C:\Windows\Fonts
-sDEVICE=pdfwrite
-dPDFSETTINGS=/default
-dCompatibilityLevel=1.3
-dProcessColorModel=/DeviceCMYK
-dAutoRotatePages=/PageByPage
-dCompressPages=true
-dEmbedAllFonts=true
-dSubsetFonts=true
-dMaxSubsetPct=100
-dConvertCMYKImagesToRGB=false
-dEncodeColorImages=true
-dAutoFilterColorImages=true
-dEncodeGrayImages=true
-dAutoFilterGrayImages=true
-dEncodeMonoImages=true
-dMonoImageFilter=/CCITTFaxEncode
-dDownsampleMonoImages=false
-dPreserveOverprintSettings=true
-dUCRandBGInfo=/Preserve
-dUseFlateCompression=true
-dParseDSCCommentsForDocInfo=true
-dParseDSCComments=true
-dOPM=0
-dOffOptimizations=0
-dLockDistillerParams=false
-dGrayImageDepth=-1
-dASCII85EncodePages=false
-dDefaultRenderingIntent=/Default
-dTransferFunctionInfo=/Preserve
-dPreserveHalftoneInfo=false
-dDetectBlends=true

Edit:

Shouldn't you also use -dAutoFilterGrayImages=false ??

With -dAutoFilterGrayImages=true (default) it will revert back to what it finds best.

I found this note somewhere:

(note 1) Currently, AutoFilterxxxImages doesn't examine the image to decide between JPEG and LZW or Flate compression: it always uses Flate compression. If you want to force JPEG compression, use -dAutoFilterxxxImages=false.

Rik
  • 13,159
  • 1
  • 34
  • 41
  • Thanks for the suggestions! I stayed with CutePDF Writer - see the update to my question. BTW, you have a typo: It should be `-dGrayImageDownsampleType` (which I don't use as I don't want resolution of the original images to be changed). – feklee Oct 21 '13 at 19:29
  • A added some info about `-dAutoFilterGrayImages=false` to my answer. (You didn't specify `-dAutoFilterGrayImages=false` and default this is true which i think means Ghostscript will use encoding it finds best. (even if you specify another encoding) **Do use** the print to CutePDF option because if the "print as PDF" is from Pagemanager itself it could mean that Ghostscript is not involved. – Rik Oct 22 '13 at 08:20
  • don't worry: There is no *"print as PDF"* in Presto! PageManager 4.20.08. The software is a bit primitive, only allowing export to various pixel and text formats (for those who use OCR), and to `.exe`! – feklee Oct 22 '13 at 08:46