Wednesday, November 18, 2009
Tuesday, November 17, 2009
Fixing EPS bounding box automatically
Writing a paper. Time to put Matlab or Scilab plots in. You go file->
save as EPS to include into Latex.
Surprise: Matlab has an awful bounding box space around the figure.
You want to autocrop it but its a vector graphics format,
so you can't use mogrify -trim +repage <filename> as you would normally
do with an image.
save as EPS to include into Latex.
Surprise: Matlab has an awful bounding box space around the figure.
You want to autocrop it but its a vector graphics format,
so you can't use mogrify -trim +repage <filename> as you would normally
do with an image.
Solution: epstool. It does an autocrop for the EPS file:
epstool --copy --bbox input.eps output.eps
and your final plot will still look crisp.
Another option: save as PDF in matlab. Then use ImageMagick's convert to convert it to eps:
convert file.pdf file.eps
this will keep the vector graphics intact (at least in recent versions of ImageMagick).
Of course, you can always use pdflatex instead and avoid EPS altogether.
Subscribe to:
Posts (Atom)