Page 1 of 1

-resize using image size information

Posted: 2015-08-03T21:59:43-07:00
by josephs
I have successfully resized the image without preserving aspect ratio using the following:

-resize 800x400!

...but I am unable to get any result using the image size information instead. There is no change in image using this:

-resize "%%[fx:w]"x"%%[fx:w/2]!

Is this a syntax issue?

Thanks for any help.

Re: -resize using image size information

Posted: 2015-08-03T23:57:13-07:00
by fmw42
No, IM 6 does not support inline fx computations for any geometry (other than in -distort via -define distort:viewport). You need to find the width and height in a separate command from for example

Code: Select all

width=`convert image -format "%w" info:`
Then use the variable in the -resize.

IM 7 is supposed to allow what you are trying to do.

Re: -resize using image size information

Posted: 2015-08-04T03:04:13-07:00
by snibgo
-resize "%%[fx:w]"x"%%[fx:w/2]!
As Fred says, this isn't valid syntax in IM v6. But you can use percentages:

Code: Select all

-resize 100%%x50%%
(Doubling the % is required for Windows BAT syntax.)