ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Arithmetic overflow on placing an external figure in MP
@ 2019-09-07 20:47 Henning Hraban Ramm
  2019-09-07 22:16 ` Fabrice L
  2019-09-08 10:43 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Henning Hraban Ramm @ 2019-09-07 20:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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:

\startMPpage
draw externalfigure "mill.png" scaled 5cm shifted (-6cm,0) ;
\stopMPpage

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]

1     \startMPpage
2     draw externalfigure "dodo.png" scaled 5cm shifted (-6cm,0) ;
3 >>  \stopMPpage
4


The same image file works with

\starttext
\externalfigure[dodo][height=8cm]
\stoptext

What’s wrong?

The image is here:
https://github.com/fiee/ConTeXt/raw/master/tshirts/img/dodo.png


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Arithmetic overflow on placing an external figure in MP
  2019-09-07 20:47 Arithmetic overflow on placing an external figure in MP Henning Hraban Ramm
@ 2019-09-07 22:16 ` Fabrice L
  2019-09-08 10:43 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Fabrice L @ 2019-09-07 22:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

> Le 7 sept. 2019 à 16:47, Henning Hraban Ramm <texml@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:
> 
> \startMPpage
> draw externalfigure "mill.png" scaled 5cm shifted (-6cm,0) ;
> \stopMPpage
> 
> 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]
> 
> 1     \startMPpage
> 2     draw externalfigure "dodo.png" scaled 5cm shifted (-6cm,0) ;
> 3 >>  \stopMPpage
> 4
> 

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:

\starttext
\startMPpage
draw externalfigure "dodo.png" sized  5cm shifted (-6cm,0) ;
\stopMPpage
\stoptext

and try:

\starttext
\startMPpage
draw externalfigure "dodo.png" scaled 0.018cm shifted (0,0) ;
draw ((0,0) -- (5cm,0) -- (5cm,5cm) -- (0,5cm) -- cycle ) withcolor red ;
\stopMPpage
\stoptext

In the second case, your image fits (approximately) in a 5cm square. 
Fabrice.


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Arithmetic overflow on placing an external figure in MP
  2019-09-07 20:47 Arithmetic overflow on placing an external figure in MP Henning Hraban Ramm
  2019-09-07 22:16 ` Fabrice L
@ 2019-09-08 10:43 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2019-09-08 10:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Henning Hraban Ramm

On 9/7/2019 10:47 PM, Henning Hraban Ramm wrote:
> 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:
> 
> \startMPpage
> draw externalfigure "mill.png" scaled 5cm shifted (-6cm,0) ;
> \stopMPpage
> 
> 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]
> 
> 1     \startMPpage

[instance=doublefun]

will bump metapost into doublemode

> 2     draw externalfigure "dodo.png" scaled 5cm shifted (-6cm,0) ;
> 3 >>  \stopMPpage
> 4
> 
> 
> The same image file works with
> 
> \starttext
> \externalfigure[dodo][height=8cm]
> \stoptext
> 
> What’s wrong?
> 
> The image is here:
> https://github.com/fiee/ConTeXt/raw/master/tshirts/img/dodo.png
> 
> 
> Greetlings, Hraban
> ---
> https://www.fiee.net
> http://wiki.contextgarden.net
> https://www.dreiviertelhaus.de
> GPG Key ID 1C9B22FD
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-08 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-07 20:47 Arithmetic overflow on placing an external figure in MP Henning Hraban Ramm
2019-09-07 22:16 ` Fabrice L
2019-09-08 10:43 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).