* externalfigure
@ 2004-09-13 12:07 Jan-Mark Batke
2004-09-13 19:49 ` externalfigure Patrick Gundlach
0 siblings, 1 reply; 9+ messages in thread
From: Jan-Mark Batke @ 2004-09-13 12:07 UTC (permalink / raw)
Dear list,
using mptopdf
externalfigure "nue-logo-1.jpg" scaled 10;
results in a figure that doesn't retain the original image
ratio.
The hints given on
http://wiki.contextgarden.net/Using_Graphics
would be what I want, but don't work in metapost?!
Any help would be appreciated
Jan-Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: externalfigure
2004-09-13 12:07 externalfigure Jan-Mark Batke
@ 2004-09-13 19:49 ` Patrick Gundlach
2004-09-13 20:24 ` externalfigure Vit Zyka
0 siblings, 1 reply; 9+ messages in thread
From: Patrick Gundlach @ 2004-09-13 19:49 UTC (permalink / raw)
Hello Jan-Mark,
> using mptopdf
>
> externalfigure "nue-logo-1.jpg" scaled 10;
>
> results in a figure that doesn't retain the original image
> ratio.
[...]
I don't think it is possible. As far as I can see, the externalfigure
command just includes a reference to the figure and metapost never
touches (reads) the picture, only the next step (mptopdf) does. So
metapost has no idea of the image attributes.
Patrick
(Standard disclaimer: usually, when I write something like this, Hans
posts a followup with some yet unknown tricks.)
--
ConTeXt wiki: http://contextgarden.net
texshow-web: http://texshow.contextgarden.net
List archive: http://archive.contextgarden.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: externalfigure
2004-09-13 19:49 ` externalfigure Patrick Gundlach
@ 2004-09-13 20:24 ` Vit Zyka
2004-09-13 22:39 ` externalfigure Patrick Gundlach
0 siblings, 1 reply; 9+ messages in thread
From: Vit Zyka @ 2004-09-13 20:24 UTC (permalink / raw)
Patrick Gundlach wrote:
> Hello Jan-Mark,
>
>
>>using mptopdf
>>
>>externalfigure "nue-logo-1.jpg" scaled 10;
>>
>>results in a figure that doesn't retain the original image
>>ratio.
>
>
> [...]
>
> I don't think it is possible. As far as I can see, the externalfigure
> command just includes a reference to the figure and metapost never
> touches (reads) the picture, only the next step (mptopdf) does. So
> metapost has no idea of the image attributes.
>
> Patrick
If you do not specify BOTH width and height of the image the pdftex have
to read image SIZE from the image file.
Metafun's externalfigure is very trickery macro. Image can't be loaded
by MP. Instead of that MP writes only MP special information (like TeX
\special) with several parameters. This info is read by ConTeXt when
including MP graphic. It inserts image file and does image transformations.
So I thing the case should work as expected. Could you send
complete-and-minimal example?
Vit Zyka
--
Vít Zýka --- http://typokvitek.com
Automatic document typesetting
Automaticka sazba dokumentu --
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: externalfigure
2004-09-13 20:24 ` externalfigure Vit Zyka
@ 2004-09-13 22:39 ` Patrick Gundlach
2004-09-14 8:36 ` externalfigure Hans Hagen
2004-09-14 11:02 ` Re: externalfigure Vit Zyka
0 siblings, 2 replies; 9+ messages in thread
From: Patrick Gundlach @ 2004-09-13 22:39 UTC (permalink / raw)
[...]
> So I thing the case should work as expected. Could you send
> complete-and-minimal example?
\starttext
\startMPcode
externalfigure "hacker.jpg" scaled 300;
\stopMPcode
\stoptext
where hacker.jpg is from the official samples.
P.
--
ConTeXt wiki: http://contextgarden.net
texshow-web: http://texshow.contextgarden.net
List archive: http://archive.contextgarden.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: externalfigure
2004-09-13 22:39 ` externalfigure Patrick Gundlach
@ 2004-09-14 8:36 ` Hans Hagen
2004-09-15 18:39 ` space in \inmargin Martin Kolarík
2004-09-14 11:02 ` Re: externalfigure Vit Zyka
1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2004-09-14 8:36 UTC (permalink / raw)
Patrick Gundlach wrote:
>[...]
>
>
>
>>So I thing the case should work as expected. Could you send
>>complete-and-minimal example?
>>
>>
>
>\starttext
>\startMPcode
>externalfigure "hacker.jpg" scaled 300;
>\stopMPcode
>\stoptext
>
>
>where hacker.jpg is from the official samples.
>
>
its possible to use the natural size, but i found out that the code that
i use for that is not in the distribution (will be in the next zip)
This will create a dimensions file mpfigs.mp:
\startmode[*first]
\executesystemcommand{texexec --fig=d *.jpg}
\stopmode
\starttext
\startMPcode
input mpfigs.mp ;
naturalfigure("hacker.jpg") ;
\stopMPcode
\stoptext
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: externalfigure
2004-09-13 22:39 ` externalfigure Patrick Gundlach
2004-09-14 8:36 ` externalfigure Hans Hagen
@ 2004-09-14 11:02 ` Vit Zyka
2004-09-15 21:31 ` Jan-Mark Batke
1 sibling, 1 reply; 9+ messages in thread
From: Vit Zyka @ 2004-09-14 11:02 UTC (permalink / raw)
>>So I thing the case should work as expected. Could you send
>>complete-and-minimal example?
>
>
> \starttext
> \startMPcode
> externalfigure "hacker.jpg" scaled 300;
> \stopMPcode
> \stoptext
It seems to me the behaviour is perhaps not intuitive but correct. I try
to explain:
Imagine externalfigure without scaling:
externalfigure "hacker.jpg";
What we will obtain? One can imagine the image in its natural size. That
is not the case. We obtain the image of the size 1pt x 1pt. I thing
there are two reasons for that:
1) Analogy. Imagine this example:
draw origin--(1,0)--(1,1)--(0,1)--cycle;
it is exactly the same as
draw origin--(1pt,0)--(1pt,1pt)--(0,1pt)--cycle;
and it is abbreviated to
draw unitsquare;
and im most cases it is used with scaling
draw unitsquare xscaled 2cm yscaled 1cm;
since
scaled X = xscaled X yscaled X
then
unitsquare scaled 2cm
is still square.
If you do not specify the unit, the pt is deduced.
So there is an analogy:
"unitfigure" 1pt x 1pt = externalfigure "file"
2) Technician. The scaling dimensions are calculated by TeX engine.
It is done by tricks in pt units, so image 1pt x 1pt simplifies
the calculations.
If you want to use a bitmap in ConTeXt MP environment in its natural
size, I suggest to precalculate (according to Hans macro \MPfigure) its
dimmensions:
% ------------------------------------
\def\getMPfiguresize#1{%
\getfiguredimensionsonly[#1]%
\freezedimenmacro\naturalfigurewidth
\freezedimenmacro\naturalfigureheight
}
\def\naturalMPfigure#1{%
externalfigure "#1"
xscaled \naturalfigurewidth\space
yscaled \naturalfigureheight\space
}
\starttext
\getMPfiguresize{hacker.jpg}
\startMPcode
\naturalMPfigure{hacker.jpg} ; % space in front of ; is important!!
\stopMPcode
\startMPcode
\naturalMPfigure{hacker.jpg} scaled 2 slanted .3;
\stopMPcode
\stoptext
%-------------------------
Vit Zyka
--
Vít Zýka --- http://typokvitek.com
Automatic document typesetting
Automaticka sazba dokumentu --
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* space in \inmargin
2004-09-14 8:36 ` externalfigure Hans Hagen
@ 2004-09-15 18:39 ` Martin Kolarík
2004-09-16 7:41 ` Hans Hagen
0 siblings, 1 reply; 9+ messages in thread
From: Martin Kolarík @ 2004-09-15 18:39 UTC (permalink / raw)
Hi all,
there is probably somewhere a space in some macro called inside \inmargin.
See example:
\starttext
\setbox0\hbox{\inmargin{XX}}
\showbox0
A\box0 B
\stoptext
and a part of log with \showbox0:
\hbox(10.41603+4.05064)x3.91663
.\glue 3.91663 plus 1.95831 minus 1.30554
.\hbox(10.41603+4.05064)x0.0
...
The first glue inside hbox seems to be product of \inmargin. Does somebody
know where the space is? I did not dig into sources yet,
have a nice day and thanks,
Martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: externalfigure
2004-09-14 11:02 ` Re: externalfigure Vit Zyka
@ 2004-09-15 21:31 ` Jan-Mark Batke
0 siblings, 0 replies; 9+ messages in thread
From: Jan-Mark Batke @ 2004-09-15 21:31 UTC (permalink / raw)
Hello Vit, hello list,
thanks for the suggestions, they are working fine. As I can
recognize its a good idea to embed my metapost code in a
context file.
Best regards
Jan-Mark
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: space in \inmargin
2004-09-15 18:39 ` space in \inmargin Martin Kolarík
@ 2004-09-16 7:41 ` Hans Hagen
0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2004-09-16 7:41 UTC (permalink / raw)
Martin � wrote:
>Hi all,
>
>there is probably somewhere a space in some macro called inside \inmargin.
>See example:
>
>\starttext
>
>\setbox0\hbox{\inmargin{XX}}
>
>\showbox0
>
>A\box0 B
>
>\stoptext
>
>and a part of log with \showbox0:
>
>\hbox(10.41603+4.05064)x3.91663
>.\glue 3.91663 plus 1.95831 minus 1.30554
>.\hbox(10.41603+4.05064)x0.0
>...
>
>The first glue inside hbox seems to be product of \inmargin. Does somebody
>know where the space is? I did not dig into sources yet,
>
>have a nice day and thanks,
>
>
a simpler way to test this is:
\ruledhbox{\inmargin{XX}}
on my machine it works ok, do you use the alpha release? (That one has a new implementation of marginal things; definable and configurable)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-09-16 7:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-13 12:07 externalfigure Jan-Mark Batke
2004-09-13 19:49 ` externalfigure Patrick Gundlach
2004-09-13 20:24 ` externalfigure Vit Zyka
2004-09-13 22:39 ` externalfigure Patrick Gundlach
2004-09-14 8:36 ` externalfigure Hans Hagen
2004-09-15 18:39 ` space in \inmargin Martin Kolarík
2004-09-16 7:41 ` Hans Hagen
2004-09-14 11:02 ` Re: externalfigure Vit Zyka
2004-09-15 21:31 ` Jan-Mark Batke
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).