我有一个wmf文件(从Excel文件中提取缩略图),我想使用以下graphicsmagick命令将其转换为jpg:
gm.exe转换123.wmf 123.jpg
结果是黑色方块。 (如果我尝试用Gimp打开文件,也会发生同样的情况)。我可以在Windows绘图中打开wmf文件(加上另一个查看器)并显示确定。
这里是wmf文件:https://mycloud.m-box.at/index.php/s/qNW2RvwRNNfkc3J
我使用的是最新版本的gm(1.3.29)
答案 0 :(得分:1)
首先检查您是否已安装WMF
格式的支持:
gm identify -version
GraphicsMagick 1.3.28 2018-01-20 Q16 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 yes
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 yes
JPEG yes
Little CMS no
Loadable Modules yes
OpenMP no
PNG yes
TIFF yes
TRIO no
UMEM no
WebP no
WMF yes <--- HERE IT IS
X11 no
XML yes
ZLIB yes
Host type: x86_64-apple-darwin17.5.0
Configured using the command:
./configure '--prefix=/usr/local/Cellar/graphicsmagick/1.3.28_1' '--disable-dependency-tracking' '--enable-shared' '--disable-static' '--with-modules' '--without-lzma' '--disable-openmp' '--with-quantum-depth=16' '--without-gslib' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts' '--with-webp=no' '--without-x' '--without-lcms2' 'CC=clang' 'CXX=clang++'
Final Build Parameters:
CC = clang
CFLAGS = -g -O2 -Wall -D_THREAD_SAFE
CPPFLAGS = -I/usr/local/opt/freetype/include/freetype2 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
CXX = clang++
CXXFLAGS = -D_THREAD_SAFE
LDFLAGS = -L/usr/local/opt/freetype/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
LIBS = -lfreetype -lbz2 -lz -lltdl -lm -lpthread
然后,如果您没有看到WMF=yes
,则需要重新配置并重建 GraphicsMagick 。因此,查找显示当前构建如何配置的行,在我的示例中是:
Configured using the command:
./configure '--prefix=/usr/local/Cellar/graphicsmagick/1.3.28_1' '--disable-dependency-tracking' '--enable-shared' '--disable-static' '--with-modules' '--without-lzma' '--disable-openmp' '--with-quantum-depth=16' '--without-gslib' ...
并删除
'--without-wmf'
并以通常的方式重新安排:
./configure ...
make -j4
sudo make install
然后你可以这样做:
gm convert -density 288 123.wmf result.jpg
如果你在macOS
,那就是:
brew reinstall graphicsmagick --with-libwmf