[NTG-context] external figure sizing

Hans Hagen pragma at wxs.nl
Sat May 9 23:07:26 CEST 2015


On 5/9/2015 10:26 PM, Csikos Bela wrote:
> Hello list members:
>
> I would like to make a photo montage (4x3 images on one page) using
> \placefigure, \externalfigure and combinations. The images should be scaled to the
> same size, eg to .25\textwith and .3\textheight so that the  aspect ratios of the images
> are kept and the appropriate value is used for width or height. That is the smaller value
> from .25\textwith and .3\textheight is used for the image size.
>
> Using only \useexternalfigure[Fig1][1.jpg][width=.25\textwidth] may not give the correct
> result if the image requires size adjustment by height and vice versa. Defining both
> width and height results in exact resizing and the aspect ratio is not maintained.
>
> How can this be solved?

\useMPlibrary[dum]

\showframe

\starttext

\setuplayout[middle]

\defineexternalfigure[quarter][factor=max]

\vbox{\dorecurse{4}{\hbox{\hsize.25\textwidth\vsize.25\textheight\dorecurse{4}{\externalfigure[dummy][quarter]}}}}

\page

\setuppapersize[A4,landscape] \setuplayout[middle]

\vbox{\dorecurse{4}{\hbox{\hsize.25\textwidth\vsize.25\textheight\dorecurse{4}{\externalfigure[dummy][quarter]}}}}

\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list