![](https://secure.gravatar.com/avatar/6e50a7aa57f5569d881f204f124d96ef.jpg?s=120&d=mm&r=g)
7 Jul
2018
7 Jul
'18
10:27 p.m.
On Sat, 7 Jul 2018 20:58:40 +0200
Marco Patzer
Hi!
How to scale an image in MetaPost, maintaining the aspect ratio (without specifying the height explicitly)?
Example:
\setupexternalfigures [location=default] \starttext \externalfigure [cow][width=5cm]
\startMPcode draw externalfigure "cow" scaled 5cm; \stopMPcode \stoptext
For "historic" reasons, draw externalfigure "cow" scaled 5cm ; normalizes the figure to a square. This will not be changed as it is a very old feature of MetaFun. The solution is draw rawtextext("\externalfigure[cow]") xsized 5cm ; where one can use xsized, ysized or xysized (taking a pair). Alan