我在 AWS EC2 实例上遇到了以下错误(我特别说明这一点,因为在我的 Mac 上没有这个问题):
Error: Command failed: gm convert: No decode delegate for this image format (/tmp/5c5830319d29e4678e8691cd-1549705844271.jpg)
文件确实存在,以防这是嫌疑人。
gm的配置如下:
[mw-user@mwServer ~]$ gm version
GraphicsMagick 1.3.31 2018-11-17 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2018 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Native Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP no
DPS no
FlashPix no
FreeType no
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG no
Little CMS no
Loadable Modules no
OpenMP yes (201511)
PNG no
TIFF no
TRIO no
UMEM no
WebP no
WMF no
X11 no
XML no
ZLIB yes
Host type: x86_64-pc-linux-gnu
Configured using the command:
./configure
Final Build Parameters:
CC = gcc
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS =
CXX = g++
CXXFLAGS = -pthread
LDFLAGS =
LIBS = -lz -lm -lpthread
我正在使用Node模块:
var gm = require('gm');
gm("/tmp/5c5830319d29e4678e8691cd-1549705844271.jpg")
.resize(450, null)
.write("/tmp/5c5830319d29e4678e8691cd-1549705844271-Resized.jpg", (function(err){
if (err) {
console.log(err);
}
}));
我对gm不是很了解,所以无法从这里开始。问题似乎是我没有JPEG的“转换器”。问题是:如何设置它以支持大多数图像格式,例如:jpg、png等?
提前感谢!