Geometry parameter parser ignores ^

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
mbrijun
Posts: 14
Joined: 2019-05-05T10:06:02-07:00
Authentication code: 1152

Geometry parameter parser ignores ^

Post by mbrijun »

On IM 7.0.9-26, the geometry parser quietly ignores the trailing '^'. These 2 commands result in 2 different image dimensions.

The quotes are missing around 100x200^ - the trailing ^ is ignored silently.

Code: Select all

magick logo: -thumbnail 100x200^ biggerNotThinWiz.png
Please note the double quotes in the second example - this geometry setting works correctly.

Code: Select all

magick logo: -thumbnail "100x200^" biggerNotThinWiz.png
Single quotes fail to work.

Code: Select all

magick logo: -resize '100x200^' biggerNotThinWiz.png
magick: invalid argument for option '-resize' ''100x200'' at CLI arg 2 @ error/operation.c/CLISimpleOperatorImage/3204.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Geometry parameter parser ignores ^

Post by snibgo »

What is your platform? If Windows, then caret "^" is the escape character, and the Windows command interpreter will remove it unless it is escaped or in double quotes.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Geometry parameter parser ignores ^

Post by fmw42 »

Either put the arguments in quotes (as you did) or escape the ^. On Unix, use \^. On Windows, as snibgo said, escape as ^^

mbrijun
Posts: 14
Joined: 2019-05-05T10:06:02-07:00
Authentication code: 1152

Re: Geometry parameter parser ignores ^

Post by mbrijun »

Makes sense. What confused me was that I was following 2 different guides on the IM official website. One was referring to single quotes (which does not work), and the other was not using any quotes at all.

https://imagemagick.org/script/command- ... p#geometry
https://www.imagemagick.org/Usage/thumbnails/

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Geometry parameter parser ignores ^

Post by snibgo »

Most IM documentation assumes that bash is used. For use under Windows, see http://www.imagemagick.org/Usage/windows/
snibgo's IM pages: im.snibgo.com

Locked