一. 官网上下载安装包
https://sourceforge.net/projects/graphicsmagick/?source=typ_redirect
二. 进行安装
$ cd GraphicsMagick
$ ./configure '--with-magick=wand/GraphicsMagickWand-config' '--enable-shared'
说明:第一个with是生成libGraphicsMagickWand.so(可能默认没有生成这个,在lib里面确实没有看到这个库),
第二个with是生成共享库(默认可能是静态的吧,我开始没用第二个,得到的库后缀是.a)
$ make
$ sudo make install
$sudo echo “/usr/local/lib”
$sudo /sbin/ldconfig
至此安装成功
三. 测试
- 直接在shell测试
$ gm
GraphicsMagick 1.3.29 2018-04-29 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.
Usage: gm command [options ...]
Where commands include:
animate - animate a sequence of images
batch - issue multiple commands in interactive or batch mode
benchmark - benchmark one of the other commands
compare - compare two images
composite - composite images together
conjure - execute a Magick Scripting Language (MSL) XML script
convert - convert an image or sequence of images
display - display an image on a workstation running X
help - obtain usage message for named command
identify - describe an image or image sequence
import - capture an application or X server screen
mogrify - transform an image or sequence of images
montage - create a composite image (in a grid) from separate images
time - time one of the other commands
version - obtain release version
2.在Torch环境下测试
> require 'graphicsmagick'
{
parseExif : function: 0x41aceb78
load : function: 0x40e11e18
save : function: 0x40e11e58
Image :
{
profile : function: 0x41acf530
compose : function: 0x41aced88
name : "magick.Image"
toString : function: 0x41acf5a8
unsharpMask : function: 0x41acef00
buffers :
{
DHW : {...}
HWD : {...}
}
setBackground : function: 0x41aced60
show : function: 0x41acf660
negate : function: 0x41aced40
gammaCorrection : function: 0x41aceeb0
crop : function: 0x41acecd0
samplingFactors : function: 0x41acee60
type : function: 0x41ace728
fromString : function: 0x41acf618
affineTransform : function: 0x41acee38
size : function: 0x41ace4a0
addNoise : function: 0x41acedf0
rotate : function: 0x41ace9a0
toBlob : function: 0x41acf580
info : function: 0x41acf680
gamma : function: 0x41acee88
colorspace : function: 0x41ace938
fromTensor : function: 0x41acf638
save : function: 0x41ace478
fromBlob : function: 0x41acf5f0
removeProfile : function: 0x41acf558
blur : function: 0x41acedd0
load : function: 0x41ace430
flatten : function: 0x41aceda8
interlace : function: 0x41ace770
format : function: 0x41ace798
toTensor : function: 0x41acf5c8
flip : function: 0x41ace960
depth : function: 0x41ace4c8
new : function: 0x41ace2f8
colorspaces : function: 0x41ace8f8
addBorder : function: 0x41acecf0
colorize : function: 0x41acee10
sharpen : function: 0x41aceed8
flop : function: 0x41ace980
floodFill : function: 0x41aced18
clone : function: 0x41ace340
path : "<>"
}
convert : function: 0x41ace648
info : function: 0x40e11808
}