Help, Command works but not in batch file?

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?".
Post Reply
jvlopez
Posts: 2
Joined: 2019-03-06T08:57:45-07:00
Authentication code: 1152

Help, Command works but not in batch file?

Post by jvlopez »

I'm running a command, which works perfectly when I type/copy it into PowerShell

Code: Select all

magick "%~dpnx1" C:/wmjvlopez.png -resize "x%[fx:t?u[0].h/18:u[0].h]" -gravity southwest -composite "%~dpn1_wmjvlopez.jpg"
If I use this command in a batch file, it fails with the following error
magick: invalid argument for option '-resize' 'xt?u[0].h/18:u[0].h]' at CLI arg 3 @ error/operation.c/CLISimpleOperatorImage/3136.
I can't figure it out and am at my wits end. If anyone can suggested anything I'd be in their debt!!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Help, Command works but not in batch file?

Post by dlemstra »

You will need to escape the percentage (%% instead of %)
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
jvlopez
Posts: 2
Joined: 2019-03-06T08:57:45-07:00
Authentication code: 1152

Re: Help, Command works but not in batch file?

Post by jvlopez »

That worked, thanks a million for your help :)
Post Reply