Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Wolfgang Schuster
Am 01.05.2014 um 20:00 schrieb Aditya Mahajan : > On Thu, 1 May 2014, Mikael P. Sundqvist wrote: >> \startluacode >> userdata = userdata or {} >> function userdata.lundklippfyllbild(str, bredd, hojd) >> if tex.dimen[0] / tex.dimen[2] < tex.dimen[4] / tex.dimen[6] then >> local skalning = >> -

Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Mikael P. Sundqvist
On Thu, May 1, 2014 at 8:00 PM, Aditya Mahajan wrote: > On Thu, 1 May 2014, Mikael P. Sundqvist wrote: >> >> \startluacode >> userdata = userdata or {} >> function userdata.lundklippfyllbild(str, bredd, hojd) >> if tex.dimen[0] / tex.dimen[2] < tex.dimen[4] / tex.dimen[6] then >> local skalni

Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Aditya Mahajan
On Thu, 1 May 2014, Mikael P. Sundqvist wrote: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] < tex.dimen[4] / tex.dimen[6] then local skalning = -0.5*(tex.dimen[4]/tex.dimen[0]*tex.dimen[2]-tex.dimen[6]) cont

Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Otared Kavian
Hi Mikael, With your new definitions and lua code I could typeset and test a few examples: it is very nice, thanks for sharing! Best regards: OK On 1 mai 2014, at 17:07, Mikael P. Sundqvist wrote: > Interesting, > > I use ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: > engli

Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Mikael P. Sundqvist
Interesting, I use ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english and it works. I now defined this with argument: \startluacode userdata = userdata or {} function userdata.lundklippfyllbild(str, bredd, hojd) if tex.dimen[0] / tex.dimen[2] < tex.dimen[4] / tex.dime

Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Otared Kavian
Hi Mikael, Out of curiosity I tried to typeset your example (after adding the usual \starttext, \stoptext), but using ConTeXt ver: 2014.04.28 23:24 MKIV beta fmt: 2014.4.29 int: english/english I obtained a TeX error: tex error > error on line 13 in file /Users/kavian/Contex

Re: [NTG-context] resize and center and clip image

2014-05-01 Thread Mikael P. Sundqvist
OK, sorry for the noise. I think I have the solution: \startexternalfigurecollection[k.jpg] \useexternalfigure[k.jpg][k.jpg] \stopexternalfigurecollection \externalfigurecollectionminwidth{k.jpg} \externalfigurecollectionmaxheight{k.jpg} \clip[width=8cm,height=7cm]{% \framed[width=8cm,hei

[NTG-context] resize and center and clip image

2014-05-01 Thread Mikael P. Sundqvist
Hi! Assume that I want to fill in the text area with images, and I want to clip and scale them according to these rules: 1) If the image is "too wide" (in sense of proportions), then scale it so that the height fits the text area height, center it, and clip it to the text area. (See the attached