[NTG-context] Set up external figure for particular image type

Thangalin thangalin at gmail.com
Mon Aug 1 02:29:29 CEST 2022


Got it working. Complete solution:

\setupexternalfigures[
  location={local,global,default},
  width=\textwidth
]\defineexternalfigure[svg][width=1cm]\defineexternalfigure[jpg][width=2cm]\defineexternalfigure[png][width=4cm]
% Won't be applied because there's no process action.% Default
(\textwidth) is used, as defined
above.\defineexternalfigure[pdf][width=6cm]
\starttexdefinition includegraphics #1
  \splitfilename{#1}

  \processaction[\splitofftype][
    jpg=>{\externalfigure[#1][jpg]},
    png=>{\externalfigure[#1][png]},
    svg=>{\externalfigure[#1][svg][conversion=mp]},
    default=>{\externalfigure[#1]},
    unknown=>{\externalfigure[#1]}
  ]\stoptexdefinition
\starttext
  \includegraphics{kitten.jpg}
  \includegraphics{mill.png}
  \includegraphics{cow.pdf}
  \includegraphics{tiger.svg}\stoptext

Image files attached.
Thanks again!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20220731/5aa9cd38/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graphics.zip
Type: application/zip
Size: 96638 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20220731/5aa9cd38/attachment-0001.zip>


More information about the ntg-context mailing list