Problem with "-set option:distort:scale" in IM6 and IM7

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Problem with "-set option:distort:scale" in IM6 and IM7

Post by GeeMack »

Using ImageMagick 7.0.8-12 Q16 x64 HDRI (and ImageMagick 6.9.10-11 Q16 x64 HDRI) on Windows, trying to set a scaling factor as described at THIS link. I enter these three commands, and the third one results in an error...

Code: Select all

magick logo: -set option:distort:scale 0.11 -distort SRT 0 test.png

magick logo: -set option:distort:scale 0.10 -distort SRT 0 test.png

magick logo: -set option:distort:scale 0.09 -distort SRT 0 test.png
magick: invalid argument for option -set option:distort:scale @ error/distort.c/DistortImage/2263.
It seems any any factor below 0.1 creates an error. Any facctor of 0.1 and above scales the image as expected.

As a note, I also get the same result with an older ImageMagick 6.8.9-9 on an Ubuntu installation under Windows.

Is this by design, a bug, an oversight?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with "-set option:distort:scale" in IM6 and IM7

Post by snibgo »

distort.c has an explicit test for values less than 0.1, throwing an error:

Code: Select all

      if ( output_scaling < 0.1 ) {
        coeff = (double *) RelinquishMagickMemory(coeff);
        (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
                "InvalidArgument","%s", "-set option:distort:scale" );
        return((Image *) NULL);
      }
In later code, I can see that values equal to or very close to zero would cause problems, but 0.1 seems far enough that it shouldn't cause problems.
snibgo's IM pages: im.snibgo.com
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Problem with "-set option:distort:scale" in IM6 and IM7

Post by GeeMack »

snibgo wrote: 2018-10-16T16:52:14-07:00distort.c has an explicit test for values less than 0.1, throwing an error:
Thanks for looking it over. I'll make sure to use other methods in cases where it might be an issue.
Post Reply