0

Currently writing a node-based utility based on the node imagemagick library to take in a stream and output another stream to STDOUT:

im = require('imagemagick')
request = require("request")

sampleImage = "http://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg"

request.get(sampleImage, (err, res, body) ->

    prefix = "-"

    switch (res.headers['content-type'])
        when "image/jpeg"
            prefix = "jpg:-"
        when "image/png"
            prefix = "png:-"

    taskHash = {
        srcPath: prefix
        srcData: body
        dstPath: -
        height: 100
    }

    callback = (err, stdout, stderr)->
        if err
            console.error(err)
            process.exit(1)
        console.log(stdout)

    im.resize(taskHash, callback)

)

Getting the following error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE
  at errnoException (net.js:904:11)
  at Object.afterWrite (net.js:720:19)

Have noticed a similar error discussed here, but I think that this is a separate case, since I'm not using the graphicsmagick library. Is it not possible to use buffers without installing both imagemagick and graphicsmagick?

fox
  • 5,569
  • 3
  • 16
  • 13

1 Answers1

0

node-imagemagick require two things:

  • Node.js
  • ImageMagick ;)

You have to install missing library (e.g. for Ubuntu):

sudo apt-get update

sudo apt-get install imagemagick --fix-missing

It will solve your problem

Community
  • 1
  • 1
Damian Gądziak
  • 895
  • 1
  • 9
  • 12