Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found" #866

Open
ramanabhinav7 opened this issue Apr 23, 2024 · 1 comment

Comments

@ramanabhinav7
Copy link

I am using windows 11
Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found"
i have used npm install imagemagick and npm i gm but still this is showing in windows
please help me
const { fromPath } = require('pdf2pic');

const options = {
density: 100,
saveFilename: "untitled",
savePath: "",
format: "jpeg",
width: 600,
height: 600
};

const convert = fromPath('invoice.pdf', options);
const pageToConvertAsImage = 1;

convert(pageToConvertAsImage, { responseType: "image" })
.then((resolve) => {
console.log("Page 1 is now converted as JPEG");

return resolve;
});
below is the error
cb(new Error('Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found"));
^

Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "-density" "100x100" "-quality" "75" "-[0]" "-resize" "600x600!" "-compress" "jpeg" "untitled.1.jpeg" this most likely means the gm/convert binaries can't be found
at ChildProcess. (C:\Users\ABHINAV KUMAR\Desktop\Node_jsm\innovice_jaishreemahakal\node_modules\gm\lib\command.js:249:12)
at ChildProcess.emit (node:events:514:28)
at cp.emit (C:\Users\ABHINAV KUMAR\Desktop\Node_jsm\innovice_jaishreemahakal\node_modules\cross-spawn\lib\enoent.js:36:37)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)

Node.js v20.9.0

@kirito286
Copy link

I am using windows 11 Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found" i have used npm install imagemagick and npm i gm but still this is showing in windows please help me const { fromPath } = require('pdf2pic');

const options = { density: 100, saveFilename: "untitled", savePath: "", format: "jpeg", width: 600, height: 600 };

const convert = fromPath('invoice.pdf', options); const pageToConvertAsImage = 1;

convert(pageToConvertAsImage, { responseType: "image" }) .then((resolve) => { console.log("Page 1 is now converted as JPEG");

return resolve; }); below is the error cb(new Error('Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found")); ^

Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "-density" "100x100" "-quality" "75" "-[0]" "-resize" "600x600!" "-compress" "jpeg" "untitled.1.jpeg" this most likely means the gm/convert binaries can't be found at ChildProcess. (C:\Users\ABHINAV KUMAR\Desktop\Node_jsm\innovice_jaishreemahakal\node_modules\gm\lib\command.js:249:12) at ChildProcess.emit (node:events:514:28) at cp.emit (C:\Users\ABHINAV KUMAR\Desktop\Node_jsm\innovice_jaishreemahakal\node_modules\cross-spawn\lib\enoent.js:36:37) at ChildProcess._handle.onexit (node:internal/child_process:294:12)

Node.js v20.9.0

This error happens because GraphicsMagick is not installed on your computer.

Windows

For windows users.. open the links and download installers.

Add the executable directories to the PATH environment variable for Ghostscript and GraphicsMagick:

  • C:\Program Files\gs\gs****\bin
  • C:\Program Files\GraphicsMagick-****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants