Page 1 of 1

Failed to Execute Command, Delegate Error?

Posted: 2015-09-08T06:20:30-07:00
by Craig
Hi folks, I have been using ImageMagick for several years but am really a novice with it. This recent issue has be just flummoxed. I am attempting to take an eps figure and convert it to a png using convert. The eps is vectorized, which I use for publishing, the png is useful for presentations.

I am using Windows 7, command-line use only. ImageMagick 6.9.2-Q16, Ghostscript 9.16

When I open a command window and type:

Code: Select all

convert logo: logo.gif
I get NO error. However, If I try the following command:

Code: Select all

convert "sensor_schematic.eps" "sensor_schematic.png" 
I receive the following error:

Code: Select all

convert.exe: FailedToExecuteCommand `"C:/Users/username/AppData/Local/ATT
Connect/Participant/GHostScript/gs/gs8.61/bin/gswin64c.exe" -q -dQUIET -dSAFER -
dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=
2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g522x45
3  "-sOutputFile=C:/Users/username/AppData/Local/Temp/magick-1920P6UnzrZEeyyC
%d" "-fC:/Users/username/AppData/Local/Temp/magick-1920jSMXaNgcAD-d" "-fC:/Us
ers/username/AppData/Local/Temp/magick-1920Lh_16i7WNJh3"' (The system cannot
find the file specified.
) @ error/delegate.c/ExternalDelegateCommand/480.
convert.exe: FailedToExecuteCommand `"C:/Users/username/AppData/Local/ATT
Connect/Participant/GHostScript/gs/gs8.61/bin/gswin64c.exe" -q -dQUIET -dSAFER -
dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=
2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g522x45
3  "-sOutputFile=C:/Users/username/AppData/Local/Temp/magick-1920P6UnzrZEeyyC
%d" "-fC:/Users/username/AppData/Local/Temp/magick-1920jSMXaNgcAD-d" "-fC:/Us
ers/username/AppData/Local/Temp/magick-1920Lh_16i7WNJh3" -c showpage' (The sy
stem cannot find the file specified.
) @ error/delegate.c/ExternalDelegateCommand/480.
convert.exe: Postscript delegate failed `The system cannot find the file specifi
ed.
' @ error/ps.c/ReadPSImage/953.
convert.exe: no images defined `sensor_schematic.png' @ error/convert.c/ConvertI
mageCommand/3230.
What caught my attention was where it was pointing to Ghostscript, it was additionally the incorrect version I have on the PC (I am using 9.16, I have had 8.61 installed at one time but since upgraded). So my first course of action was to uninstall and reinstall Ghostscript, no change. Then, I did the same with ImageMagick, no change. I tried the 32 bit versions of the software as well with no luck.

It seems like ImageMagick is looking for Ghostscript in the wrong location, I cannot figure out how to change it. I looked through the 'delegate.xml' and played with changing the PSDelegate terms to the absolute path but did not see any change with that. Admittedly, I am not sure what I am doing.

Any help is appreciated, thank you!
Craig

Re: Failed to Execute Command, Delegate Error?

Posted: 2015-09-08T07:18:49-07:00
by snibgo
From the error message, it is clearly trying to run GS v8.61. "-debug all" will say why it is doing this. On my Windows 8.1 installation, it is a registry setting.

Which variety of IM have you installed? static, dynamic (DLL) or portable? Were there any installation problems?

Check whether "C:/Users/username/AppData/Local/ATTConnect/Participant/GHostScript/gs/gs8.61/bin/gswin64c.exe" exists. If it doesn't, then that is the problem.

You might try deinstalling any versions of GS and IM, then install GS v9.16 and IM. Does IM then still look for GS 8.61?

Re: Failed to Execute Command, Delegate Error?

Posted: 2015-09-08T11:07:28-07:00
by Craig
I tried the fresh install again, that produced the same results. Using dynamic DLL install, no install problems.

Running with the debug mode lead me down the right path, thank you for that tidbit!

I knew that "C:/Users/username/AppData/Local/ATTConnect/Participant/GHostScript/gs/gs8.61/bin/gswin64c.exe" did not exist. I just did not have any idea why it was pointing there to begin with. That is an unusual directory and I never asked Ghostscript to be installed here. I considered just copying the Ghostscript executable here but that seemed like a way to make myself angry down the road.

At any rate, running debug mode lead me to to the following registry key "HKEY_CURRENT_USER/Software/GPL Ghostscript/8.61/GL_Path" The path listed here was just as above, and wrong. I deleted this registry key and I can operate as normal again, problem resolved. FWIW, I also played around with the key entry, modifying the path to point to the correct place and that also resolved it but it also felt like setting myself for future headache. However, creating a new key folder, 9.16, and the correct path produced the problem again. Getting rid of the key all together seemed like the best option.

A follow-up question would be why the registry key existed in the first place?

Re: Failed to Execute Command, Delegate Error?

Posted: 2015-09-08T11:22:22-07:00
by snibgo
Craig wrote:A follow-up question would be why the registry key existed in the first place?
That's beyond my expertise, sorry. I don't know if that key is created (and removed) by installation of GS, or installation of IM.

On Windows, IM uses the registry to record the location of delegates. I'd prefer that IM used configuration files, and delegates.xml seems the obvious candidate, but there we go.

I haven't encountered that problem before. Glad you've solved it.

Re: Failed to Execute Command, Delegate Error?

Posted: 2015-09-08T12:16:12-07:00
by dlemstra
Do you have another key in HKEY_LOCAL_MACHINE?

Did you install the 32 bit version of Ghostscript 9.16? ImageMagick will try to find the Ghostscript library that has the same architecture and use that one if it finds it. It looks like you were running the 64-bit version of ImageMagick and it found a 64-bit version of Ghostscript. I am not sure if I can change this behavior because some users might use an older version for a specific architecture. You can also set the directory with the following environment variable: MAGICK_GHOSTSCRIPT_PATH.

Re: Failed to Execute Command, Delegate Error?

Posted: 2015-09-08T13:05:58-07:00
by Craig
There is a blank key in HKEY_LOCAL_MACHINE for Ghostscript, there are several ImageMagick keys.

Incidentally, I have reverted back to the 32 bit version of Ghostscript. The reason for this is not because of the issue above but because other parts of my workflow seem to require the 32 bit version of Ghostscript. The issue above seemed resolved by deleting the key, using the 64 bit versions of both software. I then reverted to the 32 bit version of Ghostscript(keeping the 64 bit version of ImageMagick) and the error above has not come back.

If it is recommended, I will switch ImageMagick to the 32 bit version. I am not married to the 64 bit version for any reason.

The environmental variable is great information to keep note of for any future issues, thank you.