Hello,
I'm trying to convert an eps file to a pdf and i'm experiencing the pdf getting cut off on the right hand side, it seems pretty consistently.
see original eps: http://www.twinphish.net/imagemagick/19325_E_P2.eps
see pdf: http://www.twinphish.net/imagemagick/kimtest3.pdf
conversion command: convert -density 300x300 infile PDF:/pathto/outfile.pdf
-- running this on redhat ES3
-- AFPL Ghostscript 8.51 (2005-04-18)
-- ImageMagick 6.2.0 03/15/05 Q16
I've tried a number of eps files as well as previous versions of gs and imagemagick. Is my conversion script wrong or do i need to use different parameters?
thanks in advance.
EPS to PDF cuts off
Locate and edit your delegates.xml configuration file. Add -dEPSCrop to the EPS decode delgate. It should look something like this:
- <delegate decode="eps" encode="pdf" mode="bi" command='"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -dEPSCrop -sDEVICE="pdfwrite" -sOutputFile="%o" -f"%i"' />
magick wrote: Locate and edit your delegates.xml configuration file. Add -dEPSCrop to the EPS decode delgate. It should look something like this:
- <delegate decode="eps" encode="pdf" mode="bi" command='"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -dEPSCrop -sDEVICE="pdfwrite" -sOutputFile="%o" -f"%i"' />
i changed this in the delegate and it's still cutting it off..
I have this:
<delegate decode="eps" encode="pdf" mode="bi" command='"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dEPSCrop -dAlignToPixels=0 -sDEVICE="pdfwrite" -sOutputFile="%o" -f"%i"' />
does this option work in my version? I tried editing the delegate on 3 diff servers running Imagemagick and all still cut off the eps.
thx.
Re: EPS to PDF cuts off
After struggling with this for some time I chanced upon ps files created from two entirely different pieces of software and realized convert worked fine for one while with the other it cut off the right hand side. The research I'd done so far suggested a boundingbox issue and so I compared the two PS files. The one that did not work had a %%BoundingBox specified as line 2 of the postscript file (and -dEPSCrop and -dUseBoundingBox options in ghostscript, which I was trying also, did not work), while the one that did had no %%BoundingBox line. To experiment I removed the %%BoundingBox line from the non-working one and it worked perfectly with convert. So, given I have thousands of images to convert, I made this script to do the job:
for i in `ls *.ps`
do
sed /^%%BoundingBox/d $i > M$i
convert -density 300 -rotate 90 ...etc... $i $i.gif
rm $i M$i
done
This is bare bones and one can do a little more to extract a filename without the extension from the string and then have something like:
convert .......... $fn.ps $fn.gif
just so you don't end up with filenames like plot1.ps.gif, but this works for now.
Hope this helps the next person who stumbles into this issue.
D
for i in `ls *.ps`
do
sed /^%%BoundingBox/d $i > M$i
convert -density 300 -rotate 90 ...etc... $i $i.gif
rm $i M$i
done
This is bare bones and one can do a little more to extract a filename without the extension from the string and then have something like:
convert .......... $fn.ps $fn.gif
just so you don't end up with filenames like plot1.ps.gif, but this works for now.
Hope this helps the next person who stumbles into this issue.
D