\setupexternalfigures [location={local,global,default}]
\defineexternalfigure [jpg] [width=4cm]
\defineexternalfigure [png] [width=8cm]
\starttexdefinition includegraphics #1
\splitfilename{#1}
\processaction
[\splitofftype]
[ jpg=>{\externalfigure[#1][jpg]},
png=>{\externalfigure[#1][png]},
default=>{\externalfigure[#1]},
unknown=>{\externalfigure[#1]}]
\stoptexdefinition
\starttext
\includegraphics{hacker.jpg}
\includegraphics{mill.png}
\includegraphics{cow.pdf}
\stoptext