Page 1 of 1

Using -extent with set amount

Posted: 2012-11-16T03:59:18-07:00
by Swillys
I'm trying to use the extent command to increase the canvas height by a set amount, when the image height is variable.

The below would ideally increase the canvas height by 100 pixels each time regardless of the original height of the image:

convert in.jpg -resize 595 -extent 595x([Photo.PixelYDimension]+100) out.jpg

The [Photo.PixelYDimension] is part of the program I'm using, which will correctly retrieve the height of the image. The above command will shift the image 100 pixels left. Is there a clever way to use brackets for this or a workaround?

Any help much appreciated.

Re: Using -extent with set amount

Posted: 2012-11-16T12:03:38-07:00
by fmw42
You cannot do that in general with IM6. You need to save the argument from the other program into a shell variable and then do some computation with it. Then pass the shell argument to the IM command.

see
http://www.imagemagick.org/script/escape.php
http://www.imagemagick.org/script/fx.php

IM 7 (in alpha development) will be much more conducive to doing computations inline.