[metapost] How to convert .mp file into jpg file?

José Carlos Santos jcsantos at fc.up.pt
Wed Aug 29 13:08:33 CEST 2007


On 29-08-2007 10:31, liuqiang wrote:

> I use "mpost" to generate eps file. 
> My target is encapsulate jpg-styled images into my Emacs Muse files.
> So, next steps are followed:
> 1. mpost somefile.mp
> 2. generate one tex file:
> +--------------------------------------------------
> \documentclass{article}
> \usepackage{graphics}
> \begin{document}
> \begin{figure}[h]
>   \centering
>   \includegraphics{somefile.1}
> \end{figure}
> \end{document}
> +--------------------------------------------------
> 3. pdftoppm it.(convert pdf into images)
> 4. convert ppm style into jpg file.
> 
> After fininished these steps, I found the jpg file was as large as one A4 paper.
> I know the default size of pdf is A4.
> 
> I don't want this.
> Can anyone tell me how to get jpg-styled images as large as originial eps images?

Add

\pagestyle{empty}

to your LaTeX file. Let us suppose that the name of this file is
image.tex. Compile it with LaTeX and then apply dvips to the
image.dvi file, doing

dvips -E -o image.eps image

Then use Ghostscript with the -dEPSCrop option to turn it into a JPEG
file. Under Windows, I would do something like:

gswin32c -dSAFER -dBATCH -dNOPAUSE -sDEVICE#jpeg -dEPSCrop
   -sOutputFile#image.jpg image.eps

Best regards,

Jose Carlos Santos


More information about the metapost mailing list