![](https://secure.gravatar.com/avatar/30ef4fea8acc9a4c7a392675260cfcb9.jpg?s=120&d=mm&r=g)
Hello, How can I center the image on a page? I want images to cover the page completely, and since they have proper size (roughly A4), I only need them to be centered. Now they are stuck to the top, leaving a gap on bottom (and same for left-right). I have the following script (note my Lua trick to process images in a batch). Image names are "Image00001.png" and so on. %engine=luatex \setuplayout [footer=0mm, header=0mm, topspace=0mm, backspace=0mm, leftmargin=0mm, rightmargin=0mm, location=middle, height=fit, width=fit] \starttext \startluacode for n = 1, 9 do tex.print(string.format("\\externalfigure[Image%05d.png]", n)); end \stopluacode \stoptext Best regards, Vyatcheslav
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 09:55:37 -0700, Vyatcheslav Yatskovsky
Hello,
How can I center the image on a page? I want images to cover the page completely, and since they have proper size (roughly A4), I only need them to be centered. Now they are stuck to the top, leaving a gap on bottom (and same for left-right).
Did you try display mode? \vfill <arg> \vfill? I guess I don't see the complication... :-) Best Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shi`i Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
![](https://secure.gravatar.com/avatar/30ef4fea8acc9a4c7a392675260cfcb9.jpg?s=120&d=mm&r=g)
Hello Idris, Thank you. What is "display mode"? Simply \vfill\externalfigure[Image00001.jpg]\vfill doesn't work for me. -- Best regards, Vyatcheslav Yatskovsky
Hello,
How can I center the image on a page? I want images to cover the page completely, and since they have proper size (roughly A4), I only need them to be centered. Now they are stuck to the top, leaving a gap on bottom (and same for left-right).
Did you try display mode? \vfill <arg> \vfill? I guess I don't see the complication...
Best Idris
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 10:31:08 -0700, luigi scarso
On Nov 23, 2007 6:24 PM, Vyatcheslav Yatskovsky
wrote: Hello Idris,
Thank you.
What is "display mode"? Simply
\vfill\externalfigure[Image00001.jpg]\vfill
\vbox to \textheight{\vfill\vskip1sp\externalfigure[Image00001.jpg]\vskip1sp\vfill}
Alternatively, \vfill + display mode \leavevmode\vfill$$\externalfigure[cow.pdf]$$\vfill :-) Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shi`i Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 10:24:35 -0700, Vyatcheslav Yatskovsky
Hello Idris,
Thank you.
What is "display mode"? Simply
\vfill\externalfigure[Image00001.jpg]\vfill
doesn't work for me.
Try $$<arg>$$. I'm sure there's a ConTeXt-ish solution for this as well (in addition to luigi's solution), can't check at the moment... Where are you, Wolfgang? Best Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shi`i Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007, Vyatcheslav Yatskovsky wrote:
How can I center the image on a page?
\setuplayout[page] \starttext \startstandardmakeup \startalignment[middle] \dontleavehmode \externalfigure[image.png] \stopalignment \stopstandardmakeup \stoptext Cheers, Peter -- http://pmrb.free.fr/contact/
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 10:46:16 -0700, Peter Münster
On Fri, 23 Nov 2007, Vyatcheslav Yatskovsky wrote:
How can I center the image on a page?
\setuplayout[page] \starttext \startstandardmakeup \startalignment[middle] \dontleavehmode \externalfigure[image.png] \stopalignment \stopstandardmakeup \stoptext
Yes! Now let's make it even simpler: \starttext \startstandardmakeup \midaligned{\externalfigure[cow.pdf]} \stopstandardmakeup \stoptext Best Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shi`i Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 18:55:37 +0200
Vyatcheslav Yatskovsky
Hello,
How can I center the image on a page? I want images to cover the page completely, and since they have proper size (roughly A4), I only need them to be centered. Now they are stuck to the top, leaving a gap on bottom (and same for left-right).
I have the following script (note my Lua trick to process images in a batch). Image names are "Image00001.png" and so on.
%engine=luatex \setuplayout [footer=0mm, header=0mm, topspace=0mm, backspace=0mm, leftmargin=0mm, rightmargin=0mm, location=middle, height=fit, width=fit]
\starttext
\startluacode for n = 1, 9 do tex.print(string.format("\\externalfigure[Image%05d.png]", n)); end \stopluacode
\stoptext
\def\fivedigits#1% {\ifnum#1<10000 0\ifnum#1<1000 0\ifnum#1<100 0\ifnum#1<10 0\fi\fi\fi \fi\number#1} \dorecurse{9} {\startTEXpage[width=210mm,height=297mm] \centeredbox{\externalfigure[Image-\fivedigits\recurselevel]} \stopTEXpage} Wolfgang
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
2007/11/23, Vyatcheslav Yatskovsky
Hello,
How can I center the image on a page? I want images to cover the page completely, and since they have proper size (roughly A4), I only need them to be centered. Now they are stuck to the top, leaving a gap on bottom (and same for left-right).
I have the following script (note my Lua trick to process images in a batch). Image names are "Image00001.png" and so on.
%engine=luatex \setuplayout [footer=0mm, header=0mm, topspace=0mm, backspace=0mm, leftmargin=0mm, rightmargin=0mm, location=middle, height=fit, width=fit]
\starttext
\startluacode for n = 1, 9 do tex.print(string.format("\\externalfigure[Image%05d.png]", n)); end \stopluacode
\stoptext
your mail remind me to something I wanted a long time ago but I was now motivated enough to write it. Below is solution to fit a given image to a page with the normal width and height but remove parts at the top and bottom or left and right if the width height relation is different from the one of the document. I think Hans would be ablo to write a better solution but this all I can do by myself at the moment. \unprotect \def\fullpagebox {\bgroup \dowithnextbox {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax \!!widthb\dimexpr\paperheight/\nextboxht\relax \ifdim\!!widtha>\!!widthb \setbox\nextbox\vbox\!!to\paperheight{\vss\expanded{\scale[\c!width=\paperwidth]{\flushnextbox}}\vss}% \else \setbox\nextbox\hbox\!!to\paperwidth{\hss\expanded{\scale[\c!height=\paperheight]{\flushnextbox}}\hss}% \fi \setbox\nextbox\hbox{\clip[\c!width=\paperwidth,\c!height=\paperheight]{\flushnextbox}}% \startTEXpage \flushnextbox \stopTEXpage \egroup} \hbox} \protect \starttext \fullpagebox{\externalfigure[image]} \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
amazing mailing list -- luigi ... it's new . it's powerful . it's luatex . http://www.luatex.org
![](https://secure.gravatar.com/avatar/a4358949522f2efc1bab8ed68385b00c.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 12:30:48 -0700, Wolfgang Schuster
\unprotect
\def\fullpagebox {\bgroup \dowithnextbox {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax \!!widthb\dimexpr\paperheight/\nextboxht\relax \ifdim\!!widtha>\!!widthb \setbox\nextbox\vbox\!!to\paperheight{\vss\expanded{\scale[\c!width=\paperwidth]{\flushnextbox}}\vss}% \else \setbox\nextbox\hbox\!!to\paperwidth{\hss\expanded{\scale[\c!height=\paperheight]{\flushnextbox}}\hss}% \fi \setbox\nextbox\hbox{\clip[\c!width=\paperwidth,\c!height=\paperheight]{\flushnextbox}}% \startTEXpage \flushnextbox \stopTEXpage \egroup} \hbox}
\protect
\starttext
\fullpagebox{\externalfigure[image]}
\stoptext
Now THAT's the 1st-class gangster we know and love so much ;-) Question: How can we, if desired, fit the image to the page dimensions? See what happens with \starttext \fullpagebox{\externalfigure[cow][scale=fit]} \stoptext Idris -- Professor Idris Samawi Hamid, Editor-in-Chief International Journal of Shi`i Studies Department of Philosophy Colorado State University Fort Collins, CO 80523 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
On Fri, 23 Nov 2007 22:32:46 -0700
"Idris Samawi Hamid"
On Fri, 23 Nov 2007 12:30:48 -0700, Wolfgang Schuster
wrote: \unprotect
\def\fullpagebox {\bgroup \dowithnextbox {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax \!!widthb\dimexpr\paperheight/\nextboxht\relax \ifdim\!!widtha>\!!widthb \setbox\nextbox\vbox\!!to\paperheight{\vss\expanded{\scale[\c!width=\paperwidth]{\flushnextbox}}\vss}% \else \setbox\nextbox\hbox\!!to\paperwidth{\hss\expanded{\scale[\c!height=\paperheight]{\flushnextbox}}\hss}% \fi \setbox\nextbox\hbox{\clip[\c!width=\paperwidth,\c!height=\paperheight]{\flushnextbox}}% \startTEXpage \flushnextbox \stopTEXpage \egroup} \hbox}
\protect
\starttext
\fullpagebox{\externalfigure[image]}
\stoptext
Now THAT's the 1st-class gangster we know and love so much ;-)
Question: How can we, if desired, fit the image to the page dimensions? See what happens with
\starttext
\fullpagebox{\externalfigure[cow][scale=fit]}
\stoptext
Can you try \pagefigure, my solution was to scale a image to the papersize and remove parts. \pagefigure includes a figure within a TEXpage and you scale now the figure to the size of the document. \starttext \pagefigure[cow][width=\paperwidth,height=\paperheight] \stoptext Wolfgang
participants (5)
-
Idris Samawi Hamid
-
luigi scarso
-
Peter Münster
-
Vyatcheslav Yatskovsky
-
Wolfgang Schuster