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.
Using -extent with set amount
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Using -extent with set amount
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.
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.