Conversion PDF to PS
Conversion PDF to PS
I have a PDF file with a pattern. When I use ImageMagick to convert the PDF file to PS, it adds a black border for each item of the pattern. When I use Ghostscript's pds2ps for the same task, I get a correct conversion. The file is available for upload.
I have another PDF file with a pattern. It has a similar problem. But in this case each item in the pattern gets a black background when I use ImageMagick. pdf2ps does not generate this black background. The file is available for upload.
What is wrong here with ImageMagick? I know that it uses either pdf2ps or pdf2eps to get a temporary ps (or eps) file. This points to some bad parameters in delegates.xml. I have tried to use an alternative file, but was not successful in doing so.
I have another PDF file with a pattern. It has a similar problem. But in this case each item in the pattern gets a black background when I use ImageMagick. pdf2ps does not generate this black background. The file is available for upload.
What is wrong here with ImageMagick? I know that it uses either pdf2ps or pdf2eps to get a temporary ps (or eps) file. This points to some bad parameters in delegates.xml. I have tried to use an alternative file, but was not successful in doing so.
Re: Conversion PDF to PS
Post a URL to your Postscript file(s). We need to reproduce the problem before we can comment.
Re: Conversion PDF to PS
I have two examples:magick wrote:Post a URL to your Postscript file(s). We need to reproduce the problem before we can comment.
ftp://ftp.ptc.com//users/anonymous/outgoing/B-Case.ai
ftp://ftp.ptc.com//users/anonymous/outgoing/C-Case.ai
The files will be there for three days.
Thanks.
Re: Conversion PDF to PS
Add +antialias to your command line:
- convert +antialias B-Case.ai B-Case.png
Re: Conversion PDF to PS
An alternative is to change the output device for Ghostscript. I don't know why pnmraw and pngalpha fail here, but with bmpsep8, it works - including antialiasing.
You could use that:
(If you're on Unix, it's of course not 'gswin32c', but 'gs'.)
The other possibility is to edit the IM delegates.xml file for these examples. In the line '<delegate decode="ps:color"...', you might change '-sDEVICE=pnmraw' to '-sDEVICE=bmpsep8'.
You could use that:
Code: Select all
gswin32c -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=bmpsep8 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r300 -sOUTPUTFILE=temporary.bmp B-Case.ai
convert temporary.bmp -channel RGB +combine B-Case-300dpi.png
The other possibility is to edit the IM delegates.xml file for these examples. In the line '<delegate decode="ps:color"...', you might change '-sDEVICE=pnmraw' to '-sDEVICE=bmpsep8'.
Re: Conversion PDF to PS
Ok, try this:
- convert -colorspace cmyk B-Case.ai B-Case.png
Re: Conversion PDF to PS
[quote="Drarakel"]An alternative is to change the output device for Ghostscript. I don't know why pnmraw and pngalpha fail here, but with bmpsep8, it works - including antialiasing.
This suggestion removes all colors from the result PNG file.
Ghostscript is used here because ImageMagick does not handle PDF files directly, but it is transparent to the user.
This suggestion removes all colors from the result PNG file.
Ghostscript is used here because ImageMagick does not handle PDF files directly, but it is transparent to the user.
Re: Conversion PDF to PS
This suggestion works for B-Case.ai, but not for C-Case.ai. Do you know why?magick wrote:Ok, try this:
We will be able to automatically detect the CMYK colorspace when we expand on support for the XMP profile in the future.
- convert -colorspace cmyk B-Case.ai B-Case.png
Re: Conversion PDF to PS
OK, that's quicker.magick wrote:Ok, try this:
- convert -colorspace cmyk B-Case.ai B-Case.png
But the source files doesn't look like real CMYK - the K channel is empty. With pamcmyk32 or tiff32nc, one basically gets CMY here - which is the same as RGB, just negated - right?
By the way: Do you have any documentation of the pamcmyk32 device? I think it generally produces the same images than tiff32nc - is that correct? (I usually get tiny differences, but probably only due to different rounding or something like that.)
?elisegev wrote:This suggestion removes all colors from the result PNG file.
With my two methods, or with magick's, I always get the correct result - for B-Case.ai and C-Case.ai.
B-Case-300dpi.png
C-Case-300dpi.png (Link deleted)
(This is with IM v6.6.2-5 Q16 and GS 8.71.)
Last edited by Drarakel on 2010-09-25T23:28:27-07:00, edited 1 time in total.
Re: Conversion PDF to PS
I can reproduce your result only by changing the density of the conversion (i.e., -density ). Without the density directive, the borders are visible in the PNG file.Drarakel wrote:magick wrote:Ok, try this:
- convert -colorspace cmyk B-Case.ai B-Case.png
With my two methods, or with magick's, I always get the correct result - for B-Case.ai and C-Case.ai.
B-Case-300dpi.png
C-Case-300dpi.png
(This is with IM v6.6.2-5 Q16 and GS 8.71.)
Re: Conversion PDF to PS
Well, but this:
C-Case2.png (with any of the above methods, at the default 72dpi)
is still better than this:
C-Case1.png (with "convert C-Case.ai C-Case1.png")
- isnt it?
And I don't see how the colors could be missing.
If you want an even better result at 72dpi, then use a 'supersampling' approach (which is better anyway because Ghostscript sometimes 'forgets' antialiasing for some elements). So, first read in at a multiple of the desired density value, then resample:
convert -colorspace cmyk -density 288 C-Case.ai -resample 72 C-Case.png
Result here: C-Case-72_r.png
I think, C-Case.ai is not exactly the same case as B-Case.ai. With B-Case.ai, some GS devices really failed - they lose all the transparency within the objects if antialiasing is turned on. This is bad, I never saw such a case with the current Ghostscript.
With C-Case.ai however it's not so bad. There's no transparency that could get lost in the final image (apart from the white stripe at the lower edge). At most, there are 'only' some.. connection lines visible. The latter is not so unusual with some PDFs - I sometimes get this in Adobe, too. (But here, I can adjust it with some options.)
If you think the behaviour of the GS devices should be fixed, then you'll probably have to ask the people from Ghostscript.
Edit: Links deleted
C-Case2.png (with any of the above methods, at the default 72dpi)
is still better than this:
C-Case1.png (with "convert C-Case.ai C-Case1.png")
- isnt it?
And I don't see how the colors could be missing.
If you want an even better result at 72dpi, then use a 'supersampling' approach (which is better anyway because Ghostscript sometimes 'forgets' antialiasing for some elements). So, first read in at a multiple of the desired density value, then resample:
convert -colorspace cmyk -density 288 C-Case.ai -resample 72 C-Case.png
Result here: C-Case-72_r.png
I think, C-Case.ai is not exactly the same case as B-Case.ai. With B-Case.ai, some GS devices really failed - they lose all the transparency within the objects if antialiasing is turned on. This is bad, I never saw such a case with the current Ghostscript.
With C-Case.ai however it's not so bad. There's no transparency that could get lost in the final image (apart from the white stripe at the lower edge). At most, there are 'only' some.. connection lines visible. The latter is not so unusual with some PDFs - I sometimes get this in Adobe, too. (But here, I can adjust it with some options.)
If you think the behaviour of the GS devices should be fixed, then you'll probably have to ask the people from Ghostscript.
Edit: Links deleted
Last edited by Drarakel on 2010-09-25T23:29:23-07:00, edited 1 time in total.
Re: Conversion PDF to PS
Does anyone know why selecting the first page of the file (see above) will remove the colors from the PNG and leave it in gray-scale?magick wrote:
- convert -colorspace cmyk B-Case.ai[0] B-Case.png
Re: Conversion PDF to PS
For me, "convert -colorspace cmyk B-Case.ai[0] B-Case.png" gives the same exact image as "convert -colorspace cmyk B-Case.ai B-Case.png".
I'm using the current versions of ImageMagick and Ghostscript (IM 6.6.2-7 Q16, GS 8.71) - on Windows XP.
What are your versions?
I'm using the current versions of ImageMagick and Ghostscript (IM 6.6.2-7 Q16, GS 8.71) - on Windows XP.
What are your versions?
Re: Conversion PDF to PS
I was using IM 6.5.3. The issue is resolved with IM6.6.2. (I have both) Thanks for the input.Drarakel wrote:For me, "convert -colorspace cmyk B-Case.ai[0] B-Case.png" gives the same exact image as "convert -colorspace cmyk B-Case.ai B-Case.png".
I'm using the current versions of ImageMagick and Ghostscript (IM 6.6.2-7 Q16, GS 8.71) - on Windows XP.
What are your versions?