16

I'm trying to find the dimensions of the images in a production machine.It returns error.

Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%wx%h" "uploads/userPhoto-1499669685192.png" this most likely means the gm/convert binaries can't be foundsize==undefined

But it is working fine in local machine and I have already uploaded modules in production machine which are same as local machine.

akash gaur
  • 303
  • 1
  • 3
  • 9
  • What version of ImageMagick? What platform? If IM 7, then you need to write it as magick identify -ping -format "%wx%h" yourimage.png. Do not put quotes around anything but "%wx%h". Have you specified the correct path to your images? Perhaps your production machine does not have the path to imagemagick (convert or magick) in its PATH environment variable. On unix, it is typically /usr/bin/convert or /usr/bin/local/convert – fmw42 Jul 11 '17 at 17:32

5 Answers5

17

According to source code for gm, this error happens when spawn (function to start a process) returns ENOENT, which is the low-level error for "no entry", meaning the required program was not found in $PATH for the running node process (I mean it might be present but you still need to check environment of running process).

So it is a simple installation issue of the required components. Local machine has all af them, but not your production machine. You said you have "already uploaded all modules" (I think you mean all npm modules), but that is not enough, the gm module relies on one of GraphicsMagick or ImageMagick.

Quote from main page for gm:

First download and install GraphicsMagick or ImageMagick.

qlown
  • 527
  • 3
  • 8
  • Can you tell how to install ImageMagick on ubuntu 16.0.4? – Suresh Pattu Jul 22 '17 at 07:00
  • 1
    `sudo apt install imagemagick` ? Or `sudo apt install graphicsmagick` for the alternative. – qlown Jul 25 '17 at 20:07
  • I am facing this issue in windows.. and I have downlload and uploaded eventhough am getting this error – Vishnu Jul 04 '18 at 07:32
  • 2
    Coming here 1.5 year later since this is still an issue for some libraries & packages. You can easily install these packages via brew. `brew install imagemagick graphicsmagick`. – Jonathan Nielsen Nov 07 '18 at 09:39
5

Probably graphicsmagick / imagemagick is not installed correctly, download GraphicsMagick or download ImageMagick, if your are using Ubuntu, these commands are useful.

sudo add-apt-repository ppa:dhor/myway
sudo apt-get update
sudo apt-get install graphicsmagick
sudo apt-get install imagemagick

and I list a few examples of the identify command here to illustrate its usefulness and ease of use. To get started, lets identify an image in the JPEG format:

$ 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 more options and information from this link.

3

This is old, but I have no problems in Fedora, but on Ubuntu (I'm using Travis CI):

This don't work

 sudo apt-get -y install imagemagick

This works:

 sudo apt-get -y install graphicsmagick
jcubic
  • 61,973
  • 54
  • 229
  • 402
1

This worked for me:

  1. Open up command prompt as admin, navigate to project folder, and type "grunt" at command prompt.
  2. If you get an error that says "grunt hasn't been installed locally to your project", make sure both grunt and grunt-cli are installed.

If you are on Windows and still get an error, reinstall via ImageMagick.exe:

  1. Visit http://www.imagemagick.org/script/download.php#windows and download the exe file.
  2. Run it on your local machine.
  3. Select "Install legacy utilities (e.g. convert) on 'Select Additional Tasks'.
  4. After installation is complete, type "grunt" from your project directory in cmd.
Sikander
  • 121
  • 2
  • 9
0

If you installed ImageMagick then you have to create a symlink to gm in an exposed directory like /usr/local/bin on Mac from your magick binary Executing this should help.

ln -s /path/to/bin/magick /path/to/bin/gm

gm should be placed in the path exposed to the terminal.

MernXL
  • 316
  • 2
  • 6