- 
                Notifications
    You must be signed in to change notification settings 
- Fork 154
Description
Description of the error in console
/repo/node_modules/gm/lib/command.js:318
err = new Error('Command failed: ' + stderr);
^
Error: Command failed: gm convert: Improper image header (/var/folders/cs/l780tq_j2f70ml2j7qxzyp3w0000gp/T/gmCFO1v4).
at ChildProcess.onExit (/repo/node_modules/gm/lib/command.js:318:17)
at ChildProcess.emit (node:events:520:28)
at maybeClose (node:internal/child_process:1105:16)
at Socket. (node:internal/child_process:457:11)
at Socket.emit (node:events:520:28)
at Pipe. (node:net:337:12) {
code: 1,
signal: null
}
To Reproduce
Steps to reproduce the behavior:
- Create nodeJS server
- add code from pdf2image readme file
- start server
- error occurs when you try to convert local pdf file
Versions:
- OS: MacOS
- Node version: v22.1
- pdf2pic version 3.1.3
- graphicsmagick/imagemagick version: 1.3.45
- ghostscript version: 10.04.0
Pdf I am trying to convert is very minimal 1 test page that I made from Word and is not protected!
Please help! No idea what I am doing wrong!
========== My code:
const options =
{
saveFilename: "untitled",
savePath: "./images",
};
const convert = fromPath(filePath, options);
const pageToConvertAsImage = 1;
convert(pageToConvertAsImage, { responseType: "image" })
.then((resolve) => {
console.log("Page 1 is now converted as image");
return resolve;
});