[NTG-context] resize and center and clip image

Mikael P. Sundqvist mickep at gmail.com
Thu May 1 13:50:37 CEST 2014


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 image, on top, where the blue area
is supposed to show the text area and the red rectangle the image.)

2) If the image is "too high" (in sense of proportions), then scale it
so that the width fits the text area width, center it, and clip it to
the text area. (See the attached image, on bottom.)

The background why I want to do this is that I'm making a small
template for presentations, and I'd like the users to insert images as
background without really having to think about if their proportions
fit or not.

Best regards, Mikael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contextresizecenter.png
Type: image/png
Size: 8957 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20140501/a863c8d9/attachment.png>


More information about the ntg-context mailing list