[dev-context] small patch for grph-inc.lua

Hans Hagen pragma at wxs.nl
Sat Jan 5 13:16:01 CET 2013


On 1/4/2013 12:15 AM, Peter Münster wrote:
> Hi Hans,
>
> Could you please add the following little patch (or something similar)
> to grph-inc.lua:
>
> --- grph-inc.lua~  2013-01-03 23:32:37.297732874 +0100
> +++ grph-inc.lua   2013-01-03 23:42:18.237157620 +0100
> @@ -571,6 +571,9 @@
>                   if resolution and resolution ~= "" then -- the order might change
>                       newbase = newbase .. "_" .. resolution
>                   end
> +                local width = figures.current().request.width or ""
> +                local height = figures.current().request.height or ""
> +                newbase = newbase .. "_" .. width .. "_" .. height
>                   --
>                   -- see *, we had:
>                   --

I don't like that figures.current reference there; also, the image isn't 
always scanned yet so the original dimensions are not known.

The code a bit below that checks for a time change so that should cover 
an update of an image and trigger a resample.

Now, if it is the target width/height you want to be part of the name, 
then it should be some option, because the one thing you don't want is 
for instance an eps to pdf converter to be applied 10 times if the same 
image (logo or so) is included 10 times in a different size.

> The image-downsampling-module¹ would work much better then, because when
> the name of the file includes the width and the height, there will be a
> new conversion when the figure dimensions change.
>
> ¹ http://modules.contextgarden.net/grph-downsample

Hans

-----------------------------------------------------------------
                                           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 dev-context mailing list