aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.96k stars 616 forks source link

Error: Command failed: gm identify: No decode delegate for this image format #590

Open olalonde opened 8 years ago

olalonde commented 8 years ago

When trying to convert a PSD to a PNG, I am getting this error:

Error: Command failed: gm identify: No decode delegate for this image format (/var/folders/67/wj749ptn3jlb4_nlf9nphyy00000gn/T/gmegI596).
gm identify: Request did not return an image.

    at ChildProcess.onExit (/Users/olalonde/code/project/node_modules/gm/lib/command.js:301:17)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)

It is working fine for other image types however. I tried $ convert -format png test/files/kitty.psd preview.png in the console and that works.

olalonde commented 8 years ago

Code to reproduce:

import gm from 'gm'
import { join } from 'path'
import kitchenfile from 'kitchenfile'

const file = kitchenfile(join(__dirname), './files')

const kitty = file('kitty.psd')

gm(kitty.rs()).identify((err, result) => {
  console.log(err)
  console.log(result)
})

where files/kitty.psd is https://github.com/sindresorhus/file-type/blob/master/fixture/fixture.psd

olalonde commented 8 years ago

Narrowed down the problem a bit with DEBUG=gm. Now able to reproduce error in console.

This works:

cat test/files/kitty.psd | identify -

but this doesn't

cat test/files/kitty.psd | /usr/local/bin/gm identify -

So I guess identify is imagemagick and not graphicsmagick. And I suppose my graphicsmagick installation (brew install graphicsmagick) does not support PSDs?

olalonde commented 8 years ago

Opened issue on Homebrew: https://github.com/Homebrew/homebrew-core/issues/6072

JustinYi922 commented 7 years ago

您好。我在unbutu上也遇到了这个问题。在Mac上,运行确实正常的。 Error: Command failed: gm identify: No decode delegate for this image format (images/bd.png). gm identify: Request did not return an image

找了很久的方法。在头部 var fs = require('fs') , gm = require('gm'); 改为 var fs = require('fs') , gm = require('gm').subClass({imageMagick: true});