[metapost] Including graphics in MP
ALFREDO DE JESUS NAVARRO ROBLES
navarro at us.es
Thu May 18 15:41:36 CEST 2023
Perhaps it is this what you are looking for?
https://www.ctan.org/pkg/exteps
exteps – Include EPS figures in METAPOST
Exteps is a module for including external EPS figures into METAPOST figures. It is written entirely in METAPOST, and does not therefore require any post processing of the METAPOST output.
________________________________
De: metapost <metapost-bounces+navarro=us.es at tug.org> en nombre de Laurence.Finston at gmx.net <Laurence.Finston at gmx.net>
Enviado: jueves, 18 de mayo de 2023 10:31
Para: metapost at tug.org <metapost at tug.org>
Asunto: [metapost] Including graphics in MP
Hello,
Is it possible to include PostScript graphics, or literal PostScript in general, in MP files?
The purpose is to composite multiple images with correct alignment.
It's possible to do this in TeX (see below), but it would be nice to be able to do this directly in MP.
I've determined that this doesn't work:
%prologues := 3;
%outputtemplate := "%j_%c.ps";
outputformat:="png";
outputformatoptions:="format=rgb antialias=none";
outputtemplate := "%j_%c.png";
verbatimtex \input epsf etex;
path q[];
beginfig(1);
q0 = (unitsquare scaled 2cm) shifted (-1cm, -1cm);
draw q0 withpen pencircle scaled .333mm;
label(btex \vbox{\hbox{\epsffile{testdot1.eps}}} etex, origin);
endfig;
end;
It fails silently and the resulting PNG file is just a white square (see attachment). It doesn't work with EPS output, either.
It does work to do this in TeX:
\input epsf
\parindent=0pt
\parskip=0pt
\baselineskip=0pt
\advance\hoffset by -1in
\advance\voffset by -1in
\nopagenumbers
\def\epsfsize#1#2{#1}
\vbox to 0pt{\vskip2cm\hbox to 0pt{\hskip1cm
\epsffile{testdot1.eps}\hss}\vss}
\vbox to 0pt{\vskip2cm
\hbox to 0pt{\hskip1cm\epsffile{testdot2.eps}\hss}\vss}
\vfil\eject
\bye
The result is in `testinclude.pdf' (attached).
Any help would be much appreciated.
Laurence Finston
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20230518/4e09e40e/attachment.htm>
More information about the metapost
mailing list.