Page 1 of 1

Portable version adding to Windows's Environmental Variables problem

Posted: 2016-09-14T09:32:25-07:00
by FateTrader
Running a batch resizing an image which is inside the same folder as the ImageMagic files works. BUT I want to be able to use a batch file from outside the folder containing the ImageMagic files. Normally with other CMD programs I do this by adding a path within Windows's Environmental Variables and this works great, but with ImageMagic done this way it tells me: "Invalid Parameter - -resize" (which as I said the same batch file within the programs folder works fine)

Any idea why this happens?

Re: Portable version adding to Windows's Environmental Variables problem

Posted: 2016-09-14T09:49:22-07:00
by Bonzo
It is probably calling the windows program called convert and that does not have a resize option.

Re: Portable version adding to Windows's Environmental Variables problem

Posted: 2016-09-14T09:55:21-07:00
by snibgo
As Bonzo says. That message comes from the Microsoft program, not ImageMagick.

The cure is either to add IM's directory to your system path, or to always call "convert" with an explicit path.

Re: Portable version adding to Windows's Environmental Variables problem

Posted: 2016-09-14T09:59:58-07:00
by FateTrader
Thank you very much guys explicit/absolute path solved the problem

instead of:

Code: Select all

for %%a in ("*.PNG") do convert.exe "%%a" -resize 1920x1080 "%%~na.PNG"
I have this now and this works well:

Code: Select all

for %%a in ("*.PNG") do "c:\Program Files (x86)\Batch Files\convert.exe" "%%a" -resize 1920x1080 "%%~na.PNG"

Re: Portable version adding to Windows's Environmental Variables problem

Posted: 2016-09-14T10:10:58-07:00
by snibgo
That's it. But I suggest you use an environment variable for the path. Eg, have a system-wide variable called IM set to c:\Program Files (x86)\Batch Files\
and then call "%IM%convert".

Re: Portable version adding to Windows's Environmental Variables problem

Posted: 2016-09-14T10:22:05-07:00
by FateTrader
snibgo wrote:That's it. But I suggest you use an environment variable for the path. Eg, have a system-wide variable called IM set to c:\Program Files (x86)\Batch Files\
and then call "%IM%convert".
This works great, thanks a lot!