下载相应的lib,编译安装就行了
cd ~ #下载包 wget http://www.imagemagick.org/download/delegates/zlib-1.2.7.tar.gz wget http://www.imagemagick.org/download/delegates/libpng-1.6.2.tar.gz wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/delegates/libjpeg-6b.tar.gz wget http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgraphicsmagick%2Ffiles%2Fgraphicsmagick%2F1.3.18%2F&ts=1372041452&use_mirror=jaist tar zvxf zlib-1.2.7.tar.gz tar zvxf libpng-1.6.2.tar.gz tar zvxf libjpeg-6b.tar.gz tar zvxf GraphicsMagick-1.3.18.tar.gz #安装 cd ~/zlib-1.2.7 ./configure make make install cd ~/libjpeg-6b ./configure make make install cd ~/libpng-1.2.49 ./configure make make install cd ~/GraphicsMagick-1.3.18 ./configure make make install
> fs.readdirSync('./upload/') [ 'c21142262b6e78eeeed5ddbc173efe0d.jpg', '3e90077423737f7986a559a355631046.jpg', '8a3aee002f1740d3ec4f1eba3d703b8c.jpg', 'df5f8c5af3311df01d002bbdcdb89925.jpg', '5074358977fdcbca7667571f7246004e.jpg', '85baa7049a7b87e9b35369a01aae33b9.jpg', '62e9071d0b685f32d423e3d74c3eaab1.jpg', '65bd0cb519c557fd4f519ae5bef1b97d.jpg' ] > var jpg = gm('./upload/' + fs.readdirSync('./upload/')[0]); undefined > jpg.size(function(){console.log(arguments);}); { domain: null, _events: { size: [Function] }, _maxListeners: 10, _options: {}, data: {}, _in: [], _out: [], _outputFormat: null, _subCommand: 'convert', source: './upload/c21142262b6e78eeeed5ddbc173efe0d.jpg', _sourceFormatters: [ [Function] ], bufferStream: false } > { '0': undefined, '1': { width: 1280, height: 800 } }
OK!
http://www.imagemagick.org/download/delegates/
http://www.2cto.com/os/201302/187352.html
http://blog.ericlamb.net/2008/11/fix-for-convert-no-decode-delegate-for-this-image-format/