Error: Failed to execute GraphicsMagick / ImageMagick: Determine "-ping" "-format" "% wx% h"
I am trying to find the dimensions of images on a production machine. It returns an error.
GraphicsMagick / ImageMagick failed: detect "-ping" "-format" "% wx% h" "uploads / userPhoto-1499669685192.png" this most likely means the gm / convert binaries could not be found. == undefined
But it works fine on the local machine and I have already loaded the modules into the production machine which are the same as on the local machine.
source to share
According to the source code for gm , this error occurs when spawn
(the function to start the process) returns ENOENT
that there is a low level error for "no entry", that is, the required program was not found in $PATH
for the node process being run (I mean it can present, but you still need to check the process runtime).
So this is a simple problem of installing the prerequisites. The local machine has everything, but not your production machine. You said that you "already have all modules loaded" (I think you mean all npm modules), but that is not enough, the module gm
relies on one of GraphicsMagick or ImageMagick.
Quoting from the main page for gm :
First download and install GraphicsMagick or ImageMagick.
source to share
Maybe graphicsmagick / imagemagick is not installed correctly, download GraphicsMagick or download ImageMagick if you are using Ubuntu, these commands are helpful.
sudo add-apt-repository ppa:dhor/myway
sudo apt-get update
sudo apt-get install graphicsmagick
sudo apt-get install imagemagick
and I'll list a few examples of the identity command here to illustrate its usefulness and ease of use. To get started, you can define a JPEG image:
$ magick identify rose.jpg
> rose.jpg JPEG 70x46 70x46+0+0 8-bit sRGB 2.36KB 0.000u 0:00.000
Or, to get the print size in inches of an image at 72 DPI, use:
$ magick identify -format "%[fx:w/72] by %[fx:h/72] inches" document.png
> 8.5 x 11 inches
You can find additional options and information from this link.
This worked for me:
- Open a command prompt as an administrator, navigate to your project folder and enter "grunt" at the command prompt.
- If you get an error that says "grunt was not installed locally in your project", make sure both grunt and grunt-cli are installed.
If you are on Windows and still getting the error, reinstall with ImageMagick.exe:
- Visit http://www.imagemagick.org/script/download.php#windows and download the exe file.
- Run it on your local machine.
- Select "Install legacy utilities (such as convert) under Select additional tasks."
- Once the installation is complete, enter "grunt" from the project directory into cmd.
source to share