On Sat, 7 Jul 2018 20:58:40 +0200
Marco Patzer <li...@homerow.info> wrote:

> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to