Ghostscript - PS to PDF - Inverted images problem
I'm trying to convert postscri开发者_JAVA百科pt to PDF using Ghostscript.
Everything is converted ok except in some cases images are for some reason inverted.
Reported bug info: http://bugs.ghostscript.com/show_bug.cgi?id=691759
Now, they say that this bug was fixed. I downloaded ghostscript 8.70, 8.71, 9.00 and tryed all three versions and result is a same.
GSView shows postscript as it should be and does not invert the images.
Anyone has any idea?
Well, reading the comment no. 4 for GS bug 691759 it looks like this was fixed in Ghostscript's subversion source code repository in r120005 on the 7th of January 2011.
Did you compile Ghostscript r12005 yourself and re-test it? You cannot complain about Ghostscript v8.70, v8.71 or v9.00 -- these were all released bevor SVN r12005. And v9.01 (or whatever release version they will choose next) is not yet out (though it should be within the next 2-3 months according to their schedule).
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!
精彩评论