Page 1 of 1
Using "-distort Resize" with FX substitutions...
Posted: 2016-10-06T05:10:09-07:00
by GeeMack
Running ImageMagick-6.9.6-0-Q16-HDRI-x64-static on Windows 10 64, it appears there's a problem using FX expression substitutions in a "-distort Resize" operation. Both of these commands should resize the gradient to 240x120 pixels...
Code: Select all
convert -size 480x240 gradient: -distort Resize %[h]x testing.png
Code: Select all
convert -size 480x240 gradient: -distort Resize %[fx:w/2]x testing.png
Instead they both run without warnings or errors, but they produce output images which are still 480x240. IM6 doesn't seem to have any trouble using FX expressions and substitutions with other "-distort" methods like "Affine". Is there a reason it shouldn't work with "-distort Resize", or is this maybe a bug?
Re: Using "-distort Resize" with FX substitutions...
Posted: 2016-10-06T07:21:15-07:00
by snibgo
I wasn't aware that FX expressions are supposed to work with "-distort Resize" on v6.
Re: Using "-distort Resize" with FX substitutions...
Posted: 2016-10-06T08:02:35-07:00
by GeeMack
snibgo wrote:I wasn't aware that FX expressions are supposed to work with "-distort Resize" on v6.
While it may be that FX escapes aren't meant to work with "-distort Resize", the documentation mentions
HERE that "You can also use Percent Escapes within the distort arguments," and provides an example using "-distort Affine". I've tried the example in various ways with simple escapes and with expressions like "%[fx:w*2]", and it seems to work as expected.
Re: Using "-distort Resize" with FX substitutions...
Posted: 2016-10-06T08:48:48-07:00
by snibgo
Historically, I think "-distort resize" was added after the other distorts, as a drop-in replacement for "-resize", so had to parse and process its arguments in the same way.
For v6, in wand\mogrify.c, function MogrifyImage(), after "-distort" is found, the "resize" method is treated differently to all other methods. "resize" uses ParseRegionGeometry(), but all other methods use InterpretImageProperties(), and this is what translates %[stuff].
Re: Using "-distort Resize" with FX substitutions...
Posted: 2016-10-06T08:50:52-07:00
by fmw42
It does not work for me in IM 6.9.6.0 Q16 Mac OSX. But does work with IM 7.0.3.2 Q16.
Code: Select all
magick -size 480x240 gradient: -distort Resize "%[fx:w/2]" testing.png
Re: Using "-distort Resize" with FX substitutions...
Posted: 2016-10-06T09:48:31-07:00
by GeeMack
snibgo wrote:Historically, I think "-distort resize" was added after the other distorts, as a drop-in replacement for "-resize", so had to parse and process its arguments in the same way.
That makes sense. I use IM7 for almost everything, but I keep a recent IM6 installed so I can test stuff, mostly for questions on this forum. I didn't know if FX escape and expression processing was part of "-distort" or part of each method.