[luatex] howto: scaling an image
Hartmut Henkel
hartmut_henkel at gmx.de
Sun Mar 21 22:27:32 CET 2010
On Sun, 21 Mar 2010, Patrick Gundlach wrote:
> Am 21.03.2010 um 21:50 schrieb Hartmut Henkel:
> > On Sun, 21 Mar 2010, Patrick Gundlach wrote:
> >
> >>> When I load an image with img.new({filename=...}) I don't have
> >>> access to the width/height or xsize/ysize before I turn the image
> >>> into a node. Once it is a whatsit node, I have (as far as I
> >>> understand) two alternatives:
> >>
> >> I see that with img.scan I get the data, so I'd guess that just
> >> changing img.width and img.height should do it, right?
> >
> > yes. or only one of these to keep the aspect ratio.
>
> No:
>
> local hacker = img.scan{filename = "hacker.jpg"}
>
> hacker.width = hacker.width * 0.5
> node.write(img.node(hacker))
>
> gives me a distorted image.
right, forgot: set the others to nil, and it will be re-scaled.
(xsize question i have to check)
Regards, Hartmut
More information about the luatex
mailing list