[NTG-context] Arithmetic overflow on placing an external figure in MP
fabrice.alpha at gmail.com
Sun Sep 8 00:16:26 CEST 2019
> Le 7 sept. 2019 à 16:47, Henning Hraban Ramm <texml at fiee.net> a écrit :
> Bear with me, I still got no experience in MetaPost…
> I’m trying to place a pixel image on a MP page.
> According to the MetaFun manual this should work:
> draw externalfigure "mill.png" scaled 5cm shifted (-6cm,0) ;
> And it works with mill.png (copied into my test dir), but with none of my other PNGs, I always get
> ! Arithmetic overflow.
> <*> ...xternalfigure "dodo.png" scaled 5cm shifted
> (-6cm,0) ; ;
> Uh, oh. A little while ago one of the quantities that I was
> computing got too large, so I'm afraid your answers will be
> somewhat askew. You'll probably have to adopt different
> tactics next time. But I shall try to carry on anyway.
> 1 \startMPpage
> 2 draw externalfigure "dodo.png" scaled 5cm shifted (-6cm,0) ;
> 3 >> \stopMPpage
I can reproduce your error with MKIV, but this world with lmtx; I think this is just too big for MKIV (I’m not sure why !).
Be aware of the difference between « scaled » and « sized ». You can try:
draw externalfigure "dodo.png" sized 5cm shifted (-6cm,0) ;
draw externalfigure "dodo.png" scaled 0.018cm shifted (0,0) ;
draw ((0,0) -- (5cm,0) -- (5cm,5cm) -- (0,5cm) -- cycle ) withcolor red ;
In the second case, your image fits (approximately) in a 5cm square.
More information about the ntg-context