1.

Solve : Invalid Parameter?

Answer»

I have a function that doesn't work in context, but does as an independent program.  One of the 3rd party external commands I am using (convert) is throwing a Invalid Parameter error.  Any ideas why?

Both montage and convert are from imagemagick = http://www.imagemagick.org/index.php


Code: (fail) [Select]
T:\mtg>pushd "T:\mtg\\packs\pack_1"

T:\mtg\packs\pack_1>montage -geometry 400x550 card_0.jpg card_1.jpg card_2.jpg c
ard_o_1.jpg

T:\mtg\packs\pack_1>montage -geometry 400x550 card_3.jpg card_4.jpg card_5.jpg c
ard_o_2.jpg

T:\mtg\packs\pack_1>montage -geometry 400x550 card_6.jpg card_7.jpg card_8.jpg c
ard_o_3.jpg

T:\mtg\packs\pack_1>montage -geometry 400x550 card_9.jpg card_10.jpg card_11.jpg
 card_o_4.jpg

T:\mtg\packs\pack_1>montage -geometry 400x550 card_12.jpg card_13.jpg card_14.jp
g card_o_5.jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 -rotate 90 card_o_1.jpg card_o_1.
jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 -rotate 90 card_o_2.jpg card_o_2.
jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 -rotate 90 card_o_3.jpg card_o_3.
jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 -rotate 90 card_o_4.jpg card_o_4.
jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 -rotate 90 card_o_5.jpg card_o_5.
jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 card_o_1.jpg card_o_2.jpg card_o_
3.jpg pg_1.jpg

T:\mtg\packs\pack_1>montage -geometry 550x1200 card_o_4.jpg card_o_5.jpg pg_2.jp
g

T:\mtg\packs\pack_1>montage -geometry 1200x1650 -rotate 270 pg_1.jpg pg_1.jpg

T:\mtg\packs\pack_1>montage -geometry 1200x1100 -rotate 270 pg_2.jpg pg_2.jpg

T:\mtg\packs\pack_1>convert pg_1.jpg 1.pdf
Invalid Parameter - 1.pdf

T:\mtg\packs\pack_1>convert pg_2.jpg 2.pdf
Invalid Parameter - 2.pdf

T:\mtg\packs\pack_1>popd
Code: (pass) [Select]
T:\mtg\packs\pack_1>..\..\montage -geometry 400x550 card_0.jpg card_1.jpg card_2
.jpg card_o_1.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 400x550 card_3.jpg card_4.jpg card_5
.jpg card_o_2.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 400x550 card_6.jpg card_7.jpg card_8
.jpg card_o_3.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 400x550 card_9.jpg card_10.jpg card_
11.jpg card_o_4.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 400x550 card_12.jpg card_13.jpg card
_14.jpg card_o_5.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 -rotate 90 card_o_1.jpg car
d_o_1.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 -rotate 90 card_o_2.jpg car
d_o_2.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 -rotate 90 card_o_3.jpg car
d_o_3.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 -rotate 90 card_o_4.jpg car
d_o_4.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 -rotate 90 card_o_5.jpg car
d_o_5.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 card_o_1.jpg card_o_2.jpg c
ard_o_3.jpg pg_1.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 550x1200 card_o_4.jpg card_o_5.jpg p
g_2.jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 1200x1650 -rotate 270 pg_1.jpg pg_1.
jpg

T:\mtg\packs\pack_1>..\..\montage -geometry 1200x1100 -rotate 270 pg_2.jpg pg_2.
jpg

T:\mtg\packs\pack_1>..\..\convert pg_1.jpg pg_1.pdf

T:\mtg\packs\pack_1>..\..\convert pg_2.jpg pg_2.pdf

T:\mtg\packs\pack_1>pause
Press any key to continue . . .

Code: (Stand Alone) [Select] ..\..\montage -geometry 400x550 card_0.jpg card_1.jpg card_2.jpg card_o_1.jpg
..\..\montage -geometry 400x550 card_3.jpg card_4.jpg card_5.jpg card_o_2.jpg
..\..\montage -geometry 400x550 card_6.jpg card_7.jpg card_8.jpg card_o_3.jpg
..\..\montage -geometry 400x550 card_9.jpg card_10.jpg card_11.jpg card_o_4.jpg
..\..\montage -geometry 400x550 card_12.jpg card_13.jpg card_14.jpg card_o_5.jpg

..\..\montage -geometry 550x1200 -rotate 90 card_o_1.jpg card_o_1.jpg
..\..\montage -geometry 550x1200 -rotate 90 card_o_2.jpg card_o_2.jpg
..\..\montage -geometry 550x1200 -rotate 90 card_o_3.jpg card_o_3.jpg
..\..\montage -geometry 550x1200 -rotate 90 card_o_4.jpg card_o_4.jpg
..\..\montage -geometry 550x1200 -rotate 90 card_o_5.jpg card_o_5.jpg

..\..\montage -geometry 550x1200 card_o_1.jpg card_o_2.jpg card_o_3.jpg pg_1.jpg
..\..\montage -geometry 550x1200 card_o_4.jpg card_o_5.jpg pg_2.jpg

..\..\montage -geometry 1200x1650 -rotate 270 pg_1.jpg pg_1.jpg
..\..\montage -geometry 1200x1100 -rotate 270 pg_2.jpg pg_2.jpg

..\..\convert pg_1.jpg pg_1.pdf
..\..\convert pg_2.jpg pg_2.pdf
pause
Code: (function) [Select]:combine_Image dir
REM the dir referenced by ..\.. was added to path earlier in the script
echo on
pushd %1
montage -geometry 400x550 card_0.jpg card_1.jpg card_2.jpg card_o_1.jpg
montage -geometry 400x550 card_3.jpg card_4.jpg card_5.jpg card_o_2.jpg
montage -geometry 400x550 card_6.jpg card_7.jpg card_8.jpg card_o_3.jpg
montage -geometry 400x550 card_9.jpg card_10.jpg card_11.jpg card_o_4.jpg
montage -geometry 400x550 card_12.jpg card_13.jpg card_14.jpg card_o_5.jpg

montage -geometry 550x1200 -rotate 90 card_o_1.jpg card_o_1.jpg
montage -geometry 550x1200 -rotate 90 card_o_2.jpg card_o_2.jpg
montage -geometry 550x1200 -rotate 90 card_o_3.jpg card_o_3.jpg
montage -geometry 550x1200 -rotate 90 card_o_4.jpg card_o_4.jpg
montage -geometry 550x1200 -rotate 90 card_o_5.jpg card_o_5.jpg

montage -geometry 550x1200 card_o_1.jpg card_o_2.jpg card_o_3.jpg pg_1.jpg
montage -geometry 550x1200 card_o_4.jpg card_o_5.jpg pg_2.jpg

montage -geometry 1200x1650 -rotate 270 pg_1.jpg pg_1.jpg
montage -geometry 1200x1100 -rotate 270 pg_2.jpg pg_2.jpg

convert pg_1.jpg 1.pdf
convert pg_2.jpg 2.pdf

::del *.jpg
popd
goto :eof
would giving the full name with file extension help SINCE the system might not know that convert is an EXE for example so if convert is an exe you can change it to:

T:\mtg\packs\pack_1>..\..\convert.exe pg_1.jpg pg_1.pdf

T:\mtg\packs\pack_1>..\..\convert.exe pg_2.jpg pg_2.pdf


Not sure if you would also have to place the pg_1.jpg pg_1.pdf within " " or not as well, but I'd try first without the " "

I have run into similar issues with some perl scripts that I made that call to other utilities etc to perform processes beyond that of batch etc, and adding the full name with file extension fixed it for me.

CONVERT is an internal command to Windows.  So you need to specify the full path to the convert program you are using. QUOTE from: Squashman on December 14, 2014, 03:33:41 PM

CONVERT is an internal command to Windows.  So you need to specify the full path to the convert program you are using.

I will try that, but I don't think that's the issue as the program is executing.  It just isn't recognizing one of the inputs that It would normally recognize. Quote from: Lemonilla on December 14, 2014, 05:06:00 PM
I will try that, but I don't think that's the issue as the program is executing.  It just isn't recognizing one of the inputs that It would normally recognize.
Yes it is executing Windows Convert command.  See my output. LOOKS just like your error.
Code: [Select]C:\Users\Squashman>convert pg_1.jpg 1.pdf
Invalid Parameter - 1.pdf Quote
It just isn't recognizing one of the inputs that It would normally recognize.

Do the files have to be within " " MAYBE?

such as

T:\mtg\packs\pack_1>..\..\convert.exe "pg_1.jpg pg_1.pdf"

T:\mtg\packs\pack_1>..\..\convert.exe "pg_2.jpg pg_2.pdf"Oh, I didn't realize windows had a convert command. That fixed it, thanks! Quote from: Lemonilla on December 14, 2014, 06:08:40 PM
Oh, I didn't realize windows had a convert command. That fixed it, thanks!
Been there for almost 20 years. Basically since Windows NT came out. Quote from: Squashman on December 15, 2014, 06:22:02 AM
Been there for almost 20 years. Basically since Windows NT came out.
I got caught by this when I first started using Image Magick. In batch scripts you have to run the batch from the same folder as the IM convert.exe program, or provide the full path to it,  or rename the IM program, e.g. to imconvert.exe, or you can rename the Windows c:\windows\System32\convert.exe to something else (it converts FAT volumes to NTFS and if you have bever heard of it, you probably don't need it, and if you subsequently do, you can rename it back).




Discussion

No Comment Found