c# - Using ProcessStartInfo with ImageMagick's Mogrify -


tearing hair out on should ridiculously simple! have cd'd c:\program files\imagemagick-6.9.0-q16 on shell , used following command string works on machine; creates expected output image, no problem:

convert "c:\users\someguy\debug\test_in.jpg" -resize 75x75 -colorspace rgb "c:\users\someguy\debug\test_out.jpg"

i trying automate simple test application in c#:

var proc = new process             {                 startinfo = new processstartinfo()                 {                     //workingdirectory = @"c:\program files\imagemagick-6.9.0-q16\",                     arguments = //_arguments,                     "convert \"" + inputpath + "\" -resize 75x75 \"" + outputpath + "\""                     ,                     useshellexecute = _useshellexecute,                     redirectstandarderror = _redirectstandarderror,                     //redirectstandardoutput = _redirectstandardoutput,                     //createnowindow = _createnowindow,                     //verb = _verb,                     filename = @"c:\program files\imagemagick-6.9.0-q16\" + "convert.exe"                 }             };             var test = proc.startinfo.arguments.tostring();             proc.start();             string error = proc.standarderror.readtoend();             proc.waitforexit(); 

i have tried several permutations of this, using convert.exe, mogrify.exe, verb "runas", working directory set on, or off... (see commented out stuff - i've tried setting it) have referred how use imagemagick c# continue same error:

mogrify.exe: unable open image convert': no such file or directory @ error/blob.c/openblob/2709. mogrify.exe: no decode delegate image format' @ error/constitute.c/readimage/501. mogrify.exe: unable open image `c:\users\someguy\debug\test_out.jpg': no such file or directory @ error/blob.c/openblob/2709.

i feel i'm missing basic here, don't have clue @ point. please offer suggestion?

var proc = new process             {                 startinfo = new processstartinfo(_imagemagickfile)                 {                     //workingdirectory = @"c:\program files\imagemagick-6.9.0-q16\",                     arguments = //_arguments,                     "" + inputpath + " -resize 75x75 " + outputpath + ""                     ,                     useshellexecute = _useshellexecute,                     redirectstandarderror = _redirectstandarderror,                     redirectstandardoutput = _redirectstandardoutput,                     createnowindow = _createnowindow,                     verb = _verb,                     filename = _imagemagickfile                 }             };             var test = proc.startinfo.arguments.tostring();             proc.start();             string error = proc.standarderror.readtoend();             proc.waitforexit(); 

i'm not sure why works instead of original question, does. using convert.exe indeed correct, not mogrify.exe. fyi, other parameters shellexecute = false, redirect std err/out set true, verb runas.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -