我在Linux的Windows子系统上使用Ubuntu 18.04.1 LTS (仿生海狸)。我按照这些说明安装了ImageMagick,唯一的例外是ImageMagick版本当前是7.0.10-34,而不是7.0.4-5:https://www.tutorialspoint.com/how-to-install-imagemagick-on-ubuntu。
我已经下载了一个测试.gif,并成功地运行了convert giphy.gif -flip new.gif、magick giphy.gif giphy.tif和identify giphy.gif等命令,但是当我尝试使用"panda.jpg“或"15k4881.tif”运行相同的命令时,我得到了以下错误:
$ identify panda.jpg
identify: no decode delegate for this image format `JPG' @ error/constitute.c/ReadImage/562.
$ convert 15k4881.tif -flip 15k4881.tif
convert: no decode delegate for this image format `TIF' @ error/constitute.c/ReadImage/562. convert: no images defined `15k4881.tif' @ error/convert.c/ConvertImageCommand/3285.
我对这一切都是非常非常陌生的,但从下面的输出中我可以看出,.jpg、.tif和.png都不受支持,也没有合适的委托。我该怎么做才能修改这些文件类型?
$ identify -list format给了我
Format Mode Description
3FR r-- Hasselblad CFV/H3D39II
3G2 r-- Media Container
3GP r-- Media Container
A* rw+ Raw alpha samples
AAI* rw+ AAI Dune image
AI rw- Adobe Illustrator CS2
APNG rw+ Animated Portable Network Graphics
ART* rw- PFS: 1st Publisher Clip Art
ARW r-- Sony Alpha Raw Image Format
ASHLAR* -w+ Image sequence laid out in continuous irregular courses
AVI r-- Microsoft Audio/Visual Interleaved
AVS* rw+ AVS X image
B* rw+ Raw blue samples
BGR* rw+ Raw blue, green, and red samples
BGRA* rw+ Raw blue, green, red, and alpha samples
BGRO* rw+ Raw blue, green, red, and opacity samples
BMP* rw- Microsoft Windows bitmap image
BMP2* rw- Microsoft Windows bitmap image (V2)
BMP3* rw- Microsoft Windows bitmap image (V3)
BRF* -w- BRF ASCII Braille format
C* rw+ Raw cyan samples
CAL* r-- Continuous Acquisition and Life-cycle Support Type 1
Specified in MIL-R-28002 and MIL-PRF-28002
CALS* r-- Continuous Acquisition and Life-cycle Support Type 1
Specified in MIL-R-28002 and MIL-PRF-28002
CANVAS* r-- Constant image uniform color
CAPTION* r-- Caption
CIN* rw- Cineon Image File
CIP* -w- Cisco IP phone image format
CLIP* rw+ Image Clip Mask
CMYK* rw+ Raw cyan, magenta, yellow, and black samples
CMYKA* rw+ Raw cyan, magenta, yellow, black, and alpha samples
CR2 r-- Canon Digital Camera Raw Image Format
CR3 r-- Canon Digital Camera Raw Image Format
CRW r-- Canon Digital Camera Raw Image Format
CUBE* r-- Cube LUT
CUR* rw- Microsoft icon
CUT* r-- DR Halo
DATA* rw+ Base64-encoded inline images
DCM* r-- Digital Imaging and Communications in Medicine image
DICOM is used by the medical community for images like X-rays. The
specification, "Digital Imaging and Communications in Medicine
(DICOM)", is available at http://medical.nema.org/. In particular,
see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
and supplement 61 which adds JPEG-2000 encoding.
DCR r-- Kodak Digital Camera Raw Image File
DCRAW r-- Raw Photo Decoder (dcraw)
DCX* rw+ ZSoft IBM PC multi-page Paintbrush
DDS* rw+ Microsoft DirectDraw Surface
DNG r-- Digital Negative
DPX* rw- SMPTE 268M-2003 (DPX 2.0)
Digital Moving Picture Exchange Bitmap, Version 2.0.
See SMPTE 268M-2003 specification at http://www.smtpe.org
DXT1* rw+ Microsoft DirectDraw Surface
DXT5* rw+ Microsoft DirectDraw Surface
EPDF rw- Encapsulated Portable Document Format
EPI rw- Encapsulated PostScript Interchange format
EPS rw- Encapsulated PostScript
EPS2 -w- Level II Encapsulated PostScript
EPS3 -w+ Level III Encapsulated PostScript
EPSF rw- Encapsulated PostScript
EPSI rw- Encapsulated PostScript Interchange format
ERF r-- Epson RAW Format
FAX* rw+ Group 3 FAX
FAX machines use non-square pixels which are 1.5 times wider than
they are tall but computer displays use square pixels, therefore
FAX images may appear to be narrow unless they are explicitly
resized using a geometry of "150x100%".
FILE* r-- Uniform Resource Locator (file://)
FITS* rw- Flexible Image Transport System
FLV rw+ Flash Video Stream
FRACTAL* r-- Plasma fractal image
FTP* --- Uniform Resource Locator (ftp://)
FTS* rw- Flexible Image Transport System
G* rw+ Raw green samples
G3* rw- Group 3 FAX
G4* rw- Group 4 FAX
GIF* rw+ CompuServe graphics interchange format
GIF87* rw- CompuServe graphics interchange format (version 87a)
GRADIENT* r-- Gradual linear passing from one shade to another
GRAY* rw+ Raw gray samples
GRAYA* rw+ Raw gray and alpha samples
HALD* r-- Identity Hald color lookup table image
HDR* rw+ Radiance RGBE image format
HISTOGRAM* -w- Histogram of the image
HRZ* rw- Slow Scan TeleVision
HTM* -w- Hypertext Markup Language and a client-side image map
HTML* -w- Hypertext Markup Language and a client-side image map
HTTP* --- Uniform Resource Locator (http://)
HTTPS* r-- Uniform Resource Locator (https://)
ICB* rw- Truevision Targa image
ICO* rw+ Microsoft icon
ICON* rw- Microsoft icon
IIQ r-- Phase One Raw Image Format
INFO -w+ The image format and characteristics
INLINE* rw+ Base64-encoded inline images
IPL* rw+ IPL Image Sequence
ISOBRL* -w- ISO/TR 11548-1 format
ISOBRL6* -w- ISO/TR 11548-1 format 6dot
JNX* r-- Garmin tile format
JSON -w+ The image format and characteristics
K* rw+ Raw black samples
K25 r-- Kodak Digital Camera Raw Image Format
KDC r-- Kodak Digital Camera Raw Image Format
LABEL* r-- Image label
M* rw+ Raw magenta samples
M2V rw+ MPEG Video Stream
M4V rw+ Raw VIDEO-4 Video
MAC* r-- MAC Paint
MAP* rw- Colormap intensities and indices
MASK* rw+ Image Clip Mask
MAT rw+ MATLAB level 5 image format
MATTE* -w+ MATTE format
MEF r-- Mamiya Raw Image File
MIFF* rw+ Magick Image File Format
MKV rw+ Multimedia Container
MONO* rw- Raw bi-level bitmap
MOV rw+ MPEG Video Stream
MP4 rw+ VIDEO-4 Video Stream
MPC* rw+ Magick Persistent Cache image format
MPEG rw+ MPEG Video Stream
MPG rw+ MPEG Video Stream
MRW r-- Sony (Minolta) Raw Image File
MSL* --- Magick Scripting Language
MSVG -w+ ImageMagick's own SVG internal renderer
MTV* rw+ MTV Raytracing image format
MVG* rw- Magick Vector Graphics
NEF r-- Nikon Digital SLR Camera Raw Image File
NRW r-- Nikon Digital SLR Camera Raw Image File
NULL* rw- Constant image of uniform color
O* rw+ Raw opacity samples
ORA --- OpenRaster format
ORF r-- Olympus Digital Camera Raw Image File
OTB* rw- On-the-air bitmap
PAL* rw- 16bit/pixel interleaved YUV
PALM* rw+ Palm pixmap
PAM* rw+ Common 2-dimensional bitmap format
PANGO* --- Pango Markup Language
PATTERN* r-- Predefined pattern
PBM* rw+ Portable bitmap format (black and white)
PCD* rw- Photo CD
PCDS* rw- Photo CD
PCL rw+ Printer Control Language
PCT* rw- Apple Macintosh QuickDraw/PICT
PCX* rw- ZSoft IBM PC Paintbrush
PDB* rw+ Palm Database ImageViewer Format
PDF rw+ Portable Document Format
PDFA rw+ Portable Document Archive Format
PEF r-- Pentax Electronic File
PES* r-- Embrid Embroidery Format
PFM* rw+ Portable float format
PGM* rw+ Portable graymap format (gray scale)
PGX* rw- JPEG 2000 uncompressed format
PICON* rw- Personal Icon
PICT* rw- Apple Macintosh QuickDraw/PICT
PIX* r-- Alias/Wavefront RLE image format
PLASMA* r-- Plasma fractal image
PNM* rw+ Portable anymap
POCKETMOD rw+ Pocketmod Personal Organizer
PPM* rw+ Portable pixmap format (color)
PS rw+ PostScript
PS2 -w+ Level II PostScript
PS3 -w+ Level III PostScript
PSB* rw+ Adobe Large Document Format
PSD* rw+ Adobe Photoshop bitmap
PWP* r-- Seattle Film Works
R* rw+ Raw red samples
RADIAL-GRADIENT* r-- Gradual radial passing from one shade to another
RAF r-- Fuji CCD-RAW Graphic File
RAS* rw+ SUN Rasterfile
RAW r-- Raw
RGB* rw+ Raw red, green, and blue samples
RGB565* r-- Raw red, green, blue samples in 565 format
RGBA* rw+ Raw red, green, blue, and alpha samples
RGBO* rw+ Raw red, green, blue, and opacity samples
RGF* rw- LEGO Mindstorms EV3 Robot Graphic Format (black and white)
RLA* r-- Alias/Wavefront image
RLE* r-- Utah Run length encoded image
RMF r-- Raw Media Format
RW2 r-- Panasonic Lumix Raw Image
SCR* r-- ZX-Spectrum SCREEN$
SCREENSHOT* r-- Screen shot
SCT* r-- Scitex HandShake
SFW* r-- Seattle Film Works
SGI* rw+ Irix RGB image
SHTML* -w- Hypertext Markup Language and a client-side image map
SIX* rw- DEC SIXEL Graphics Format
SIXEL* rw- DEC SIXEL Graphics Format
SPARSE-COLOR* -w+ Sparse Color
SR2 r-- Sony Raw Format 2
SRF r-- Sony Raw Format
STEGANO* r-- Steganographic image
SUN* rw+ SUN Rasterfile
SVG rw+ Scalable Vector Graphics
SVGZ -w+ Compressed Scalable Vector Graphics
TEXT* r-- Text
TGA* rw- Truevision Targa image
THUMBNAIL* -w+ EXIF Profile Thumbnail
TILE* r-- Tile image with a texture
TIM* r-- PSX TIM
TM2* r-- PS2 TIM2
TXT* rw+ Text
UBRL* -w- Unicode Text format
UBRL6* -w- Unicode Text format 6dot
UIL* -w- X-Motif UIL table
UYVY* rw- 16bit/pixel interleaved YUV
VDA* rw- Truevision Targa image
VICAR* rw- VICAR rasterfile format
VID* rw+ Visual Image Directory
VIFF* rw+ Khoros Visualization image
VIPS* rw+ VIPS image
VST* rw- Truevision Targa image
WBMP* rw- Wireless Bitmap (level 0) image
WEBM rw+ Open Web Media
WMV rw+ Windows Media Video
WPG* r-- Word Perfect Graphics
X3F r-- Sigma Camera RAW Picture File
XBM* rw- X Windows system bitmap (black and white)
XC* r-- Constant image uniform color
XCF* r-- GIMP image
XPM* rw- X Windows system pixmap (color)
XPS r-- Microsoft XML Paper Specification
XV* rw+ Khoros Visualization image
Y* rw+ Raw yellow samples
YCbCr* rw+ Raw Y, Cb, and Cr samples
YCbCrA* rw+ Raw Y, Cb, Cr, and alpha samples
YUV* rw- CCIR 601 4:1:1 or 4:2:2
* native blob support
r read support
w write support
+ support for multiple images$ convert -list configure给了我
Path: /usr/local/lib/ImageMagick-7.0.10//config-Q16HDRI/configure.xml
Name Value
-------------------------------------------------------------------------------
CC gcc
CFLAGS -fopenmp -Wall -g -O2 -mtune=core2 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH /usr/local/lib/ImageMagick-7.0.10/modules-Q16HDRI/coders
CONFIGURE ./configure
CONFIGURE_PATH /usr/local/etc/ImageMagick-7/
COPYRIGHT Copyright (C) 1999-2020 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick-7
CXX g++
CXXFLAGS -pthread
DEFS -DHAVE_CONFIG_H
DELEGATES mpeg
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-jemalloc=no --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-rsvg=no --with-wmf=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-7
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES DPC HDRI Cipher OpenMP
FILTER_PATH /usr/local/lib/ImageMagick-7.0.10/modules-Q16HDRI/filters
GIT_REVISION 17696
HOST x86_64-pc-linux-gnu
INCLUDE_PATH /usr/local/include/ImageMagick-7
LDFLAGS -L/usr/local/lib
LIB_VERSION 0x70A
LIB_VERSION_NUMBER 7,0,10,34
LIBRARY_PATH /usr/local/lib/ImageMagick-7.0.10
LIBS -lm -lpthread -lgomp
NAME ImageMagick
PCFLAGS -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2020-10-22
SHARE_PATH /usr/local/share/ImageMagick-7
SHAREARCH_PATH /usr/local/lib/ImageMagick-7.0.10/config-Q16HDRI
TARGET_CPU x86_64
TARGET_OS linux-gnu
TARGET_VENDOR pc
VERSION 7.0.10
WEBSITE https://imagemagick.org
Path: [built-in]
Name Value
-------------------------------------------------------------------------------
DELEGATES
FEATURES Cipher DPC HDRI OpenMP(4.5)
MAGICK_TEMPORARY_PATH /tmp
NAME ImageMagick
QuantumDepth Q16然后convert -list delegate给了我
Path: /usr/local/etc/ImageMagick-7/delegates.xml
Delegate Command
-------------------------------------------------------------------------------
blender => "blender' -b '%i' -F PNG -o '%o''\n'magick' convert -concatenate '%o*.png' '%o"
bmp<= jxr "/bin/mv '%i' '%i.bmp'; 'JxrEncApp' -i '%i.bmp' -o '%o.jxr'; /bin/mv '%i.bmp' '%i'; /bin/mv '%o.jxr' '%o"
bmp<= wdp "/bin/mv '%i' '%i.bmp'; 'JxrEncApp' -i '%i.bmp' -o '%o.jxr'; /bin/mv '%i.bmp' '%i'; /bin/mv '%o.jxr' '%o"
bpg => "bpgdec' -b 16 -o '%o.png' '%i'; /bin/mv '%o.png' '%o"
cdr => "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
cgm => "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
dng:decode => "ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i"
doc => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"
docx => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"
dot => "dot' -Tsvg '%i' -o '%o"
dvi => "dvips' -sstdout=%%stderr -o '%o' '%i"
dxf => "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
eps<=>pdf "gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 '-sDEVICE=pdfwrite' '-sOutputFile=%o' '-f%i"
eps<=>ps "gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=ps2write' '-sOutputFile=%o' '-f%i"
fig => "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
hpg => "hp2xx' -sstdout=%%stderr -m eps -f `basename '%o'` '%i'; /bin/mv -f `basename '%o'` '%o"
hpgl => "hp2xx' -sstdout=%%stderr -m eps -f `basename '%o'` '%i'; /bin/mv -f `basename '%o'` '%o"
htm => "html2ps' -U -o '%o' '%i"
html => "html2ps' -U -o '%o' '%i"
https:decode => "curl' -s -k -L -o '%u.dat' 'https:%M"
ilbm => "ilbmtoppm' '%i' > '%o"
jpg<= lep "lepton' '%i' '%o"
jxr => "/bin/mv '%i' '%i.jxr'; 'JxrDecApp' -i '%i.jxr' -o '%o.pnm'; /bin/mv '%i.jxr' '%i'; /bin/mv '%o.pnm' '%o"
lep => "lepton' '%i' '%o"
miff<= show "magick' display -immutable -delay 0 -title '%M' '%i"
odt => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"
pdf<=>eps "gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sPDFPassword='%a' '-sDEVICE=eps2write' '-sOutputFile=%o' '-f%i"
pdf<=>ps "gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=ps2write' -sPDFPassword='%a' '-sOutputFile=%o' '-f%i"
png<= bpg "bpgenc' -b 12 -q '%~' -o '%o' '%i"
png<= webp "cwebp' -quiet %Q '%i' -o '%o"
pnm<= trace "potrace' --svg --output '%o' '%i"
pnm<= ilbm "ppmtoilbm' -24if '%i' > '%o"
ppt => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"
pptx => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"
ps<= prt " lpr' '%i"
ps<=>eps "gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=eps2write' '-sOutputFile=%o' '-f%i"
ps<=>pdf "gs' -sstdout=%%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pdfwrite' '-sOutputFile=%o' '-f%i"
ps<= print "@LPRDelegateDefault@ '%i"
shtml => "html2ps' -U -o '%o' '%i"
sid => "mrsidgeodecode' -if sid -i '%i' -of tif -o '%o' > '%u"
svg => "rsvg-convert' -o '%o' '%i"
tiff<= launch "gimp' '%i"
video:decode => "avconv' -nostdin -v -1 -i '%i' -vframes %S -vcodec pam -an -f rawvideo -y '%u.pam' 2> '%u"
wdp => "/bin/mv '%i' '%i.jxr'; 'JxrDecApp' -i '%i.jxr' -o '%o.bmp'; /bin/mv '%i.jxr' '%i'; /bin/mv '%o.bmp' '%o"
webp => "dwebp' -pam '%i' -o '%o"
xls => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"
xlsx => "libreoffice' --headless --convert-to pdf -outdir `dirname '%i'` '%i' 2> '%u'; /bin/mv '%i.pdf' '%o"发布于 2021-07-18 17:45:36
如果从源代码安装ImageMagick,请确保拥有所需的委派。
例如,为了安装带有JPG、PNG和TIFF代理的ImageMagick,这些步骤是必需的。
更新apt索引:sudo apt-get update
安装Build-Essential以便配置并进行最终安装:sudo apt-get install build-essential
Libjpg62-使用基本JPG文件所需的开发工具:sudo apt-get install -y libjpeg62-dev
需要libtiff-dev才能使用TIFF文件格式:sudo apt-get install -y libtiff-dev
libpng-使用基本PNG文件所需的开发工具:sudo apt-get install -y libpng-dev
下载ImageMagick:wget https://www.imagemagick.org/download/ImageMagick.tar.gz
Untar Imagemagick:tar xvzf ImageMagick.tar.gz
访问工作目录:cd ImageMagick-*
配置禁用“共享”选项,并在已安装的源文件前加上stow目录路径:./configure --disable-shared --prefix=/usr/local/stow/ImageMagick
编译、安装和检查:sudo make && sudo make install && sudo make check
存储ImageMagick包:
cd /usr/local/stow/
stow ImageMagick确保上述代理都存在:
identify --version
Version: ImageMagick 7.1.0-4 Q16 x86_64 2021-07-17 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): freetype jbig jng jpeg lzma png tiff x xml zlib如果您需要从头开始重新安装,Gnu Stow将使卸载软件包变得更容易:
cd /usr/local/stow/
stow -D ImageMagick #it will remove the symlinked soruce files inside ../lib, ../bin, etc.
rm -rf ImageMagick/发布于 2020-10-25 12:38:23
您已经从源代码构建了自己的imagemagick。
这不是一件容易的事情--您需要许多其他的包才能正常工作(例如,如果您想要处理jpeg图像,就必须安装libjpeg和libexif的头文件),您需要非常深入地了解文件格式和文件格式库,您需要仔细考虑安全性和需要哪些委托,然后一旦构建好它,就需要对其进行维护。
相反,使用Ubuntu内置的imagemagick几乎总是更好。只需输入:
apt install imagemagick它会下载并安装一个经过测试和工作的imagemagick副本,并且会在发布错误修复时自动将其保持最新。您可能应该删除您构建的imagemagick,以减少混淆。
如果我绝对需要一个比包存储库中的包更新的版本,我才会从源代码进行构建,即使这样,我也会三思而后行。甚至三次。
https://stackoverflow.com/questions/64503416
复制相似问题