I just had this problem with gs
9.02 on Linux, so here is my solution:
After quite a bit of research, I arrived at a ghostscript
command line, that seems (to me) to implement a near "pass-through" for images in a PDF, meaning that the images in the "distilled" PDF should remain the same as the ones in the original PDF (see also How to tell ghostscript to leave bitmap images alone? - comp.text.pdf). This, then, would avoid both downsampling, and jpeg-like compression artifacts, - and possible inversions of images - during distilling.
Thanks to the answer by @pipitas in (#277826) Querying Ghostscript for the default options/settings of an output device (such as 'pdfwrite' or 'tiffg4'), I could basically look at all possible options for pdfwrite
- and then I simply tried to disable anything image related. So, the command line is this:
gs -dBATCH -dNOPAUSE \
-dAutoFilterMonoImages=false \
-dAutoFilterGrayImages=false \
-dAutoFilterColorImages=false \
-dDownsampleColorImages=false \
-dDownsampleGrayImages=false \
-dDownsampleMonoImages=false \
-dAntiAliasColorImages=false \
-dAntiAliasGrayImages=false \
-dAntiAliasMonoImages=false \
-dColorConversionStrategy=/LeaveColorUnchanged \
-dConvertImagesToIndexed=false \
-dEncodeColorImages=false \
-dEncodeGrayImages=false \
-dEncodeMonoImages=false \
-sDEVICE=pdfwrite \
-sOutputFile=output.pdf input.pdf
I tested this on ghostscript
9.02 under Ubuntu; and it worked for me... I can see the question is tagged Windows, so the formatting of the command line is likely to be different - however, I believe the same options can be set also in gs
under Windows, and they should work.
Hope this helps,
Cheers!