From Laurence.Finston at gmx.net Thu May 18 10:31:24 2023 From: Laurence.Finston at gmx.net (Laurence.Finston at gmx.net) Date: Thu, 18 May 2023 10:31:24 +0200 Subject: [metapost] Including graphics in MP Message-ID: 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 -------------- A non-text attachment was scrubbed... Name: testdot.mp Type: application/octet-stream Size: 473 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testinclude.pdf Type: application/pdf Size: 1293 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testinclude1_1.png Type: image/png Size: 292 bytes Desc: not available URL: From navarro at us.es Thu May 18 15:41:36 2023 From: navarro at us.es (ALFREDO DE JESUS NAVARRO ROBLES) Date: Thu, 18 May 2023 13:41:36 +0000 Subject: [metapost] Including graphics in MP In-Reply-To: References: Message-ID: 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 en nombre de Laurence.Finston at gmx.net Enviado: jueves, 18 de mayo de 2023 10:31 Para: 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: From Laurence.Finston at gmx.net Thu May 18 15:57:01 2023 From: Laurence.Finston at gmx.net (Laurence.Finston at gmx.net) Date: Thu, 18 May 2023 15:57:01 +0200 Subject: [metapost] Including graphics in MP In-Reply-To: References: Message-ID: An HTML attachment was scrubbed... URL: