这个图像格式没有解码委托`

时间:2016-04-22 07:27:35

标签: node.js imagemagick jpeg decode gm

使用gm包时出现奇怪的错误。我使用Windows x86。我已经安装了gm,还有imagemagick。

这是我的代码:

function convert(response, next) {
            console.time("convertImage");
            console.log("Reponse content type : " + response.ContentType);
            console.log("Conversion");

            GM(response.Body, fullName).setFormat('jpeg').antialias(true).density(300).toBuffer(
                function(err, buffer) {
                    if (err) {
                        next(err);
                    } else {
                        console.timeEnd("convertImage");
                        next(null, buffer);
                    }
                });
        }

这是我得到的错误:

Debug: internal, implementation, error
    Error: Command failed: identify.exe: no decode delegate for this image forma
t `' @ error/constitute.c/ReadImage/501.

    at ChildProcess.proc.on.onExit (d:\node.js\ImageUploaderWorker\node_modules\
gm\lib\command.js:297:17)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:827:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

你可以看到imagemagick有jpeg支持,因为我无法理解我的问题。

$ convert --version
Version: ImageMagick 6.9.3-8 Q16 x86 2016-04-10 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangoca
iro png ps rsvg tiff webp xml zlib

0 个答案:

没有答案