luthraG / image-watermark

A powerful watermark library for single page images, multipage images, and pdf files based on ImageMagick for node.js
https://www.npmjs.com/package/image-watermark
MIT License
102 stars 33 forks source link

Error: Image-Watermark::embedWatermark : Unable to process image file : Error: Command failed: identify-im6.q16: not authorized `sample.pdf' @ error/constitute.c/ReadImage/412. #19

Open Gowtham029 opened 5 years ago

Gowtham029 commented 5 years ago

Hi,

I would be grateful if some help me to solve the issue. Ubuntu - 18.04 Node - v8.10.0 image-watermark - 0.0.7

I am getting the issue when I try to add watermark on the pdf file. I have installed ImageMagick.

/home/gowtham/Desktop/node/node_modules/image-watermark/watermark.js:196
                throw new Error('Image-Watermark::embedWatermark : Unable to process image file : ' + err);
                ^

Error: Image-Watermark::embedWatermark : Unable to process image file : Error: Command failed: identify-im6.q16: not authorized `sample.pdf' @ error/constitute.c/ReadImage/412.

    at /home/gowtham/Desktop/node/node_modules/image-watermark/watermark.js:196:11
    at Accumulator.callback (/home/gowtham/Desktop/node/node_modules/imagemagick/imagemagick.js:165:5)
    at Accumulator.finish (/home/gowtham/Desktop/node/node_modules/imagemagick/imagemagick.js:60:55)
    at ChildProcess.<anonymous> (/home/gowtham/Desktop/node/node_modules/imagemagick/imagemagick.js:93:11)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
sushantpaudel commented 5 years ago

You have to install GhostScript. I faced the same problem and got an answer from stackoverflow from here.

prafulrajhm commented 3 years ago

You have to install GhostScript. I faced the same problem and got an answer from stackoverflow from here.

Can you please share the code to guide how to use GhostScript

sushantpaudel commented 3 years ago

@prafulrajhm You don't have to use anything, just install ghost-script on your system.