From - Mon Apr 16 14:24:17 2001
Return-Path: <smuelas@mecanica.upm.es>
Received: from filemon.mecanica.upm.es (filemon.mecanica.upm.es
    [138.100.66.1]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id
    f3GCO9q40343 for <metafont@ens.fr>; Mon, 16 Apr 2001 14:24:09 +0200 (CEST)
Received: from [138.100.66.37] (helo=simux.mecanica.upm.es ident=smuelas)
    by filemon.mecanica.upm.es with esmtp (Exim 3.11 #1 (Debian)) id
    14p836-00065p-00; Mon, 16 Apr 2001 14:24:08 +0200
Date: Mon, 16 Apr 2001 14:27:00 +0200 (CEST)
From: <smuelas@mecanica.upm.es>
To: Hans Hagen <pragma@wxs.nl>
Cc: <metafont@ens.fr>
In-Reply-To: <3.0.6.32.20001201092634.00a53100@pop.wxs.nl>
Message-Id: <Pine.LNX.4.30.0104161405500.2086-100000@simux.mecanica.upm.es>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanner: AMaVis 0.2.0-pre6 / Virus Scan
X-Loop: metafont@nef.ens.fr
X-Sequence: 435
Precedence: list
Subject: [metafont] Re: 0.02745 0.2745 0.16862 setrgbcolorRe: Two questions

On Fri, 1 Dec 2000, Hans Hagen wrote:
> Ok. So you make each pixel into a point. Now, since MP has an upper limit
> of [max 8 meg main mem or so]. So, one way to find out the demands is to
> study the statistics at the end of a run [by using small sample images].
> Each pixel has quite some data associated in mp: a transform, color, name,
> etc. So this limits the size of a graphic. Can you handle a 1000 * 1000
> pixel picture?

Well, I have needed quite a long time to answer your question. It was a
tricky one....

Now the answer is YES. I can cope with any size of picture without
increasing Metapost memory and at an incredible speed. You can find an
example at:      http://w3.mecanica.upm.es/metapost/dindex.html
It is not exactly a 1000 * 1000 pixel image because this width is too big.
The bigest that I have found to be posible (not for any reason related
with MetaPost) is 862 * 1170 or something like that. Otherwise, a part of
the picture is lost.
The CPU time needed to compile this bigest image by MP is around 50
seconds in a Pentium 700 portable machine.
I have done a program in Java that creates the MP file so that some
rotouching on the image is possible. I have called this program MetaFot
but I will change it if someone has used something similar in the past.
I will launch a new version of METAGRAF shortly that will include this
capability in such a way that the it will be possible to draw any MP-draw
over the image or clip this one or .... I don't know yet what more.
If you want more specific information I will be happy to give it to you.
Best regards
-- 
Santiago Muelas
E.T.S. Ingenieros de Caminos, (U.P.M)    Tf.: (34) 91 336 66 59
e-mail: smuelas@mecanica.upm.es          Fax: (34) 91 336 67 61
www: http://w3.mecanica.upm.es/~smuelas



From - Mon Apr 16 15:45:39 2001
Return-Path: <smuelas@mecanica.upm.es>
Received: from filemon.mecanica.upm.es (filemon.mecanica.upm.es
    [138.100.66.1]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id
    f3GDjUq44196 for <metafont@ens.fr>; Mon, 16 Apr 2001 15:45:30 +0200 (CEST)
Received: from [138.100.66.37] (helo=simux.mecanica.upm.es ident=smuelas)
    by filemon.mecanica.upm.es with esmtp (Exim 3.11 #1 (Debian)) id
    14p9Jq-0006HG-00 for <metafont@ens.fr>; Mon, 16 Apr 2001 15:45:30 +0200
Date: Mon, 16 Apr 2001 15:48:23 +0200 (CEST)
From: <smuelas@mecanica.upm.es>
To: <metafont@ens.fr>
Message-Id: <Pine.LNX.4.30.0104161547090.2213-100000@simux.mecanica.upm.es>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanner: AMaVis 0.2.0-pre6 / Virus Scan
X-Loop: metafont@nef.ens.fr
X-Sequence: 436
Precedence: list
Subject: [metafont] Re: 0.02745 0.2745 0.16862 setrgbcolorRe: Two
    questions (fwd)

Sorry, I have made a mistake: it can't be MetaFot as we have Metafont. It
will be MpFot.

-- 
Santiago Muelas
E.T.S. Ingenieros de Caminos, (U.P.M)    Tf.: (34) 91 336 66 59
e-mail: smuelas@mecanica.upm.es          Fax: (34) 91 336 67 61
www: http://w3.mecanica.upm.es/~smuelas


---------- Forwarded message ----------
Date: Mon, 16 Apr 2001 14:27:00 +0200 (CEST)
From: smuelas@mecanica.upm.es
To: Hans Hagen <pragma@wxs.nl>
Cc: metafont@ens.fr
Subject: Re: 0.02745 0.2745 0.16862 setrgbcolorRe: Two questions

On Fri, 1 Dec 2000, Hans Hagen wrote:
> Ok. So you make each pixel into a point. Now, since MP has an upper limit
> of [max 8 meg main mem or so]. So, one way to find out the demands is to
> study the statistics at the end of a run [by using small sample images].
> Each pixel has quite some data associated in mp: a transform, color, name,
> etc. So this limits the size of a graphic. Can you handle a 1000 * 1000
> pixel picture?

Well, I have needed quite a long time to answer your question. It was a
tricky one....

Now the answer is YES. I can cope with any size of picture without
increasing Metapost memory and at an incredible speed. You can find an
example at:      http://w3.mecanica.upm.es/metapost/dindex.html
It is not exactly a 1000 * 1000 pixel image because this width is too big.
The bigest that I have found to be posible (not for any reason related
with MetaPost) is 862 * 1170 or something like that. Otherwise, a part of
the picture is lost.
The CPU time needed to compile this bigest image by MP is around 50
seconds in a Pentium 700 portable machine.
I have done a program in Java that creates the MP file so that some
rotouching on the image is possible. I have called this program MetaFot
but I will change it if someone has used something similar in the past.
I will launch a new version of METAGRAF shortly that will include this
capability in such a way that the it will be possible to draw any MP-draw
over the image or clip this one or .... I don't know yet what more.
If you want more specific information I will be happy to give it to you.
Best regards
-- 
Santiago Muelas
E.T.S. Ingenieros de Caminos, (U.P.M)    Tf.: (34) 91 336 66 59
e-mail: smuelas@mecanica.upm.es          Fax: (34) 91 336 67 61
www: http://w3.mecanica.upm.es/~smuelas




From - Tue Apr 17 09:38:57 2001
Return-Path: <pragma@wxs.nl>
Received: from smtp9.xs4all.nl (smtp9.xs4all.nl [194.109.127.135]) by
    nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id f3H7ckq03163 for
    <metafont@ens.fr>; Tue, 17 Apr 2001 09:38:46 +0200 (CEST)
Received: from server-1.pragma-ade.nl (s340-isdn1357.dial.xs4all.nl
    [194.109.185.77]) by smtp9.xs4all.nl (8.9.3/8.9.3) with ESMTP id JAA05707;
    Tue, 17 Apr 2001 09:38:45 +0200 (CEST)
Received: from laptop-1 (laptop-1.pragma-ade.nl [200.1.1.25]) by
    server-1.pragma-ade.nl (8.9.3/8.9.3) with SMTP id JAA29606; Tue,
    17 Apr 2001 09:23:10 +0200
Message-Id: <3.0.6.32.20010417091729.009de2f0@server-1>
X-Sender: hagen@server-1
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32)
Date: Tue, 17 Apr 2001 09:17:29 +0200
To: smuelas@mecanica.upm.es
From: Hans Hagen <pragma@wxs.nl>
Cc: <metafont@ens.fr>
In-Reply-To: <Pine.LNX.4.30.0104161405500.2086-100000@simux.mecanica.upm .es>
References: <3.0.6.32.20001201092634.00a53100@pop.wxs.nl>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Virus-Scanner: AMaVis 0.2.0-pre6 / Virus Scan
X-Loop: metafont@nef.ens.fr
X-Sequence: 437
Precedence: list
Subject: [metafont] Re: 0.02745 0.2745 0.16862 setrgbcolorRe: Two questions

At 02:27 PM 4/16/01 +0200, smuelas@mecanica.upm.es wrote:
>On Fri, 1 Dec 2000, Hans Hagen wrote:
>> Ok. So you make each pixel into a point. Now, since MP has an upper limit
>> of [max 8 meg main mem or so]. So, one way to find out the demands is to
>> study the statistics at the end of a run [by using small sample images].
>> Each pixel has quite some data associated in mp: a transform, color, name,
>> etc. So this limits the size of a graphic. Can you handle a 1000 * 1000
>> pixel picture?
>
>Well, I have needed quite a long time to answer your question. It was a
>tricky one....
>
>Now the answer is YES. I can cope with any size of picture without
>increasing Metapost memory and at an incredible speed. You can find an
>example at:      http://w3.mecanica.upm.es/metapost/dindex.html
>It is not exactly a 1000 * 1000 pixel image because this width is too big.
>The bigest that I have found to be posible (not for any reason related
>with MetaPost) is 862 * 1170 or something like that. Otherwise, a part of
>the picture is lost.
>The CPU time needed to compile this bigest image by MP is around 50
>seconds in a Pentium 700 portable machine.
>I have done a program in Java that creates the MP file so that some
>rotouching on the image is possible. I have called this program MetaFot
>but I will change it if someone has used something similar in the past.
>I will launch a new version of METAGRAF shortly that will include this
>capability in such a way that the it will be possible to draw any MP-draw
>over the image or clip this one or .... I don't know yet what more.
>If you want more specific information I will be happy to give it to you.
 
I'll have a look at it. Currently i handle bitmaps in mp by using teh
metafun special mechanism [things like reusing pictures, scsling clipping
etc are also supported, but specials remain strange animals.-) 

Hans
-------------------------------------------------------------------------
                                  Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


From - Fri Apr 27 09:42:00 2001
Return-Path: <smuelas@mecanica.upm.es>
Received: from filemon.mecanica.upm.es (filemon.mecanica.upm.es
    [138.100.66.1]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id
    f3R7fmq61021 for <metafont@ens.fr>; Fri, 27 Apr 2001 09:41:48 +0200 (CEST)
Received: from [138.100.66.37] (helo=simux.mecanica.upm.es ident=smuelas)
    by filemon.mecanica.upm.es with esmtp (Exim 3.11 #1 (Debian)) id
    14t2sj-00036Y-00; Fri, 27 Apr 2001 09:41:37 +0200
Date: Fri, 27 Apr 2001 09:44:34 +0200 (CEST)
From: <smuelas@mecanica.upm.es>
To: Hans Hagen <pragma@wxs.nl>
Cc: <metafont@ens.fr>
In-Reply-To: <3.0.6.32.20010417091729.009de2f0@server-1>
Message-Id: <Pine.LNX.4.33.0104270835160.6280-100000@simux.mecanica.upm.es>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Virus-Scanner: AMaVis 0.2.0-pre6 / Virus Scan
X-Loop: metafont@nef.ens.fr
X-Sequence: 438
Precedence: list
Subject: [metafont] Re: 0.02745 0.2745 0.16862 setrgbcolorRe: Two questions

> I'll have a look at it. Currently i handle bitmaps in mp by using teh
> metafun special mechanism [things like reusing pictures, scsling clipping
> etc are also supported, but specials remain strange animals.-)

Just to tell you that the application MpFot is already available at

	http://w3.mecanica.upm.es/metapost/principal.html

and a couple of words to explain to  you how I have done to let Metapost
work with this huge files.
To make it short, the final "trick" comes from the fact that MP's time of
compilation is proportional to the square of the length of the file
to compile. That means that a bitmap file of 100 x 100 pixels is compiled
in my personal computer in less than 2 seconds. But a bitmap file of 500 x
500 needs 9 minutes (and a big amount of memory).
To let MP cope with huge files, the best solution is to cut these files in
shorter ones; to compile them creating different figures and to "paste"
the files afterwords to create the final one. This process is extremely
simple once the small routines have been created, and this is what does
MpFot. The final result is to change the proportional relation of time
consuming compilation from the square of the length to a linear relation
between time and length. You can verify this with MpFot.
Another issue is the size of the MP-PS file created. In the extremely
simple script included in the distribution, if nothing is changed, the
application outputs a PDF file one order of magnitude smaller than the
first original mp created.
Otherwise, the *.1 figure is very big but can be included in any TeX
document without any problem.
I hope you will be able to use this "trick" to create beautiful things
in Metafun.
The whole process can be understood simply looking at the script "doit.sh"
included in the distribution.

Finally, I will give you some data of time versus size of images.
Image of 100 x 100 pixels  -->  time cpu user = 1.99 sc. = 1.65 + 0.34
Image of 200 x 100 pixels  -->    "   "   "     2.32 sc. = 1.65 + 0.67
Image of 200 x 200   "     -->    "   "   "     3.08 sc. = 1.65 + 1.33
Image of 500 x 500   "     -->    "   "   "    11.88 sc. = 1.65 + 10.23

and we find that to charge MP and begin the process there exist a
"dead-time" of 1.65 seconds. Than comes the proportional time:
if we consider 10,000 pixels as the unity the relation is:

1-->0.34 || 2-->0.67 || 4-->1.33 || 25-->10.23    so, around 0.35 seconds
for every 10,000 pixels (depending on the memory to write to disc).

Best regards
-- 
Santiago Muelas
E.T.S. Ingenieros de Caminos, (U.P.M)    Tf.: (34) 91 336 66 59
e-mail: smuelas@mecanica.upm.es          Fax: (34) 91 336 67 61
www: http://w3.mecanica.upm.es/~smuelas



