`

GraphicsMagick安装、实时生成缩略图

 
阅读更多

GraphicsMagick资料

----------------------------------------------------------------------------

GraphicsMagick官网 http://www.graphicsmagick.org

GraphicsMagick编程接口  http://www.graphicsmagick.org/programming.html

ImageMagick 程序接口  http://www.imagemagick.org/api/MagickCore/

Im4java 下载地址http://sourceforge.net/projects/im4java/files/

IM4JAVA+GraphicsMagick处理网站图片  http://javantsky.iteye.com/blog/747807

 

GraphicsMagick 实时、动态缩图

----------------------------------------------------------------------------

Nginx,L ua_nginx,GraphicsMagick 灵活自定义缩略图片尺寸大小方案分享

http://www.iteye.com/topic/1125126

nginx + lua + GraphicsMagick 动态生成指定大小缩图

http://www.chinaz.com/web/2012/0903/272395.shtml

 

 

 

Mac OS x 安装 GraphicsMagick

----------------------------------------------------------------------------

安装依赖库,参考:ImageMagick +Jmagick安装

 

安装jpeg包

----------------

brew install libjpeg

安装在了/usr/local/Cellar/jpeg/8d

 

安装jasper包   

----------------

brew install jasper

安装在/usr/local/Cellar/jasper/1.900.1

 

安装libpng

----------------

由于是Mac ,所以使用brew包管理器,快速安装

rew install libpng

安装在了/usr/local/Cellar/libpng/1.5.13

 

安装freetype包

----------------

brew install freetype

安装在了/usr/local/Cellar/freetype/2.4.10

 

安装zlib包

----------------

系统自带不用安装了

 

自动安装GraphicsMagick 

----------------

自动安装:brew install GraphicsMagick

安装在了/usr/local/Cellar/graphicsmagick/1.3.17

 

查看安装信息:

zhaorai@zhaomatoMacBook-Pro lib$ gm -version

 

GraphicsMagick 1.3.17 2012-10-13 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2012 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support:
  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         no
  OpenMP                   no
  PNG                      yes
  TIFF                     no
  TRIO                     no
  UMEM                     no
  WMF                      no
  X11                      no
  XML                      yes
  ZLIB                     yes

Host type: x86_64-apple-darwin11.4.2

Configured using the command:
    ./configure  '--disable-dependency-tracking' '--prefix=/usr/local/Cellar/graphicsmagick/1.3.17' 
  '--enable-shared' '--disable-static' '--disable-openmp' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts' 
  '--without-x' 'CC=/usr/bin/llvm-gcc' 'CFLAGS=-Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7' 
  'LDFLAGS=-L/usr/local/lib -F/usr/local/Frameworks -L/usr/X11/lib' 'CPPFLAGS=-F/usr/local/Frameworks -I/usr/X11/include' 
  'CXX=/usr/bin/llvm-g++' 'CXXFLAGS=-Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7'
Final Build Parameters:
  CC       = /usr/bin/llvm-gcc -std=gnu99
  CFLAGS   = -Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7 -Wall -D_THREAD_SAFE
  CPPFLAGS = -F/usr/local/Frameworks -I/usr/X11/include -I/usr/local/Cellar/freetype/2.4.10/include/freetype2 -I/usr/include/libxml2
  CXX      = /usr/bin/llvm-g++
  CXXFLAGS = -Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7 -D_THREAD_SAFE
  LDFLAGS  = -L/usr/local/lib -F/usr/local/Frameworks -L/usr/X11/lib -L/usr/local/Cellar/freetype/2.4.10/lib -L/usr/lib
  LIBS     = -lfreetype -ljasper -ljpeg -lpng15 -lbz2 -lxml2 -lz -lm -lpthread

 

* –prefix=/opt/local 让ImageMagick/GraphicsMagick与MacPorts的库文件安装到同一个目录。

如果你想要安装到其它目录,则输入不同的目录路径,如果不声明–prefix,默认会将其安装到/usr/local。

* –disable-static和–with-modules使得ImageMagick/GraphicsMagick以动态链接库的方式安装,

现在安装ImageMagick/GraphicsMagick只是为了在Ruby中使用,所以我用–without-perl和–without-magick-plus-plus以免去安装Perl和C++的支持

* –with-quantum-depth=8配置ImageMagick使用8位的色深。默认是16位。参与RMagick Hints & Tips Forum论坛中的讨论Speed up your RMagick apps in 1 easy step了解这个选项有什么作用。

* –with-gs-font-dir=/opt/local/share/ghostscript/fonts让ImageMagick/GraphicsMagick知道Ghostscript字体安装在哪个角落里。

如果你某个目录里有“标准”的windows TrueType字体,也可以设置–with-windows-font-dir=选项让ImageMagick/GraphicsMagick使用它们。

查看ImageMagick/GraphicsMagick的README.txt文件了解更多选项的信息。

 

 

手动安装GraphicsMagick 

----------------------

手动安装

下载地址  ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/

tar zvxf GraphicsMagick-1.3.17.tar.gz

cd GraphicsMagick-1.3.17

./configure CC=clang --prefix=/usr/local/GraphicsMagick-1.3.17 --with-quantum-depth=16   --enable-shared --enable-static

make

make install

 

注意confiure命令后面的CC=clang。它指定了编译器为Mac下推荐使用的clang。如果没有这个参数,Makefile将会使用系统默认的编译器进行编译,而这个编译器不是GraphicsMagic所推荐的,并且在make的过程中会出现以下错误:

 

Undefined symbols for architecture x86_64:
  "___builtin_object_size", referenced from:
      _BlurImageScanlines.omp_fn.6 in libGraphicsMagick.a(magick_libGraphicsMagick_la-effect.o)
      _XShearImage.omp_fn.0 in libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o)
      _YShearImage.omp_fn.1 in libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [utilities/gm] Error 1
make: *** [all] Error 2

----------
ld: symbol(s) not found for architecture x86_64   
collect2: ld returned 1 exit status   
make[1]: *** [magick/libGraphicsMagick.la] Error 1
make: *** [all] Error 2

 

 

最后还是有错,未成功。

(可参考上面“自动安装”时的的./configure设置编译器,应该会成功)

 

手动安装的配置信息:

 

 

Windows 上安装GM

----------------------------------------

1、安装:略

2、信息

 

 

常用管理命令

--------------------------------------------------------------------------------------------

 

查看版本后安装情况:gm identify -version

结果::打印出信息

识别图片:gm identify  /Users/zhaorai/Pictures/照片/100CANON-1/IMG_4108.JPG

结果:/Users/zhaorai/Pictures/照片/100CANON-1/IMG_4108.JPG JPEG 3648x2736+0+0 DirectClass 8-bit 2.5M 0.000u 0:01

识别图片(高级):gm identify  -verbose /Users/zhaorai/Desktop/4.png

结果:打印出很多信息。

 


 

  • 大小: 66.6 KB
  • 大小: 56 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics