Summary: | white border is added while fake-printing pdf to png | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Maciej Pilichowski <bluedzins> |
Component: | Graphics Library | Assignee: | Default assignee <ghostpdl-bugs> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | 8.64 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: |
black.pdf
gs-black.png |
Description
Maciej Pilichowski
2009-02-11 09:59:16 UTC
I guess, you need to use -dUseCropBox option but it's hard to tell without a sample PDF file. If -dUseCropBox doesn't work for you, please attach your PDF file to the bug report. The result is changed, but there is still some white leftovers. Attachment follows (btw. this pdf is from converting black png image into pdf). Created attachment 4788 [details]
black.pdf
Created attachment 4790 [details]
gs-black.png
Seems to work for me. Attaching the output of
$ bin/gs -dUseCropBox -r300 -sDEVICE=pnggray -o gs-black.png black.pdf
I do see a small white border looking at the attached pdf in evince. The image
matrix does look incorrect to fill the crop box:
/MediaBox [0 0 640 400]
/CropBox [0 0 154 96]
...
153.6 0 0 96.0002 0 0 cm
/Im0 Do
If I change the matrix to match the CropBox dimensions, the remaining border
goes away.
The white remains are identical to mine when I added cropbox. But you have to modify the matrix by hand, so it is a workaround, not a solution (but thank you for the tip). My point is -- it should be automatic. I can convert png to pdf file 100% automatically, and the result is identical to the source. Now, I should be able to do the same with converting pdf to png. My claim in #4 is that the pdf is not 100% identical to the source png. The problem is that the file draw the image slightly smaller than the CropBox; Ghostscript appears to be rendering that faithfully. Perhaps Imagemagick is rounding the CropBox but not the image matrix. Or just rounding the two differently. In printing, it is common to extend the border colours outside the CropBox (so-called "full bleed") to avoid issues like this. Especially since an actual physical crop is unlikely to be precise. Imagemagick doesn't seem to be doing this either. If you know the border colour you might be able to work around by adding '-background black', for example, to your convert command line. Adobe Acrobat 8 and 9 both show the white line along the right hand side, the same as Ghostscript. We are correctly rendering the PDF, closing as WORKSFORME Ok, I just want to ensure -- the problem with printing .pdf to .png using GS is caused by incorrectly constructed .pdf file (by ImageMagick)? Did you understand you right? (if yes, I think it would be the best to post a report again IM but for .png -> .pdf conversion, and after the fix in IM test it again in GS for .pdf -> .png "printing"). Yes, the problem you're having is from Imagemagick. Ghostscript is rendering the created pdf correctly. |