`
stephen830
  • 浏览: 2964676 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

GraphicsMagick安装、实时生成缩略图

 
阅读更多

 

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包管理器,快速安装

brew 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

 

C代码  收藏代码
  1. GraphicsMagick 1.3.17 2012-10-13 Q8 http://www.GraphicsMagick.org/  
  2. Copyright (C) 2002-2012 GraphicsMagick Group.  
  3. Additional copyrights and licenses apply to this software.  
  4. See http://www.GraphicsMagick.org/www/Copyright.html for details.  
  5.   
  6. Feature Support:  
  7.   Thread Safe              yes  
  8.   Large Files (> 32 bit)   yes  
  9.   Large Memory (> 32 bit)  yes  
  10.   BZIP                     yes  
  11.   DPS                      no  
  12.   FlashPix                 no  
  13.   FreeType                 yes  
  14.   Ghostscript (Library)    no  
  15.   JBIG                     no  
  16.   JPEG-2000                yes  
  17.   JPEG                     yes  
  18.   Little CMS               no  
  19.   Loadable Modules         no  
  20.   OpenMP                   no  
  21.   PNG                      yes  
  22.   TIFF                     no  
  23.   TRIO                     no  
  24.   UMEM                     no  
  25.   WMF                      no  
  26.   X11                      no  
  27.   XML                      yes  
  28.   ZLIB                     yes  
  29.   
  30. Host type: x86_64-apple-darwin11.4.2  
  31.   
  32. Configured using the command:  
  33.     ./configure  '--disable-dependency-tracking' '--prefix=/usr/local/Cellar/graphicsmagick/1.3.17'   
  34.   '--enable-shared' '--disable-static' '--disable-openmp' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts'   
  35.   '--without-x' 'CC=/usr/bin/llvm-gcc' 'CFLAGS=-Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7'   
  36.   'LDFLAGS=-L/usr/local/lib -F/usr/local/Frameworks -L/usr/X11/lib' 'CPPFLAGS=-F/usr/local/Frameworks -I/usr/X11/include'   
  37.   'CXX=/usr/bin/llvm-g++' 'CXXFLAGS=-Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7'  
  38. Final Build Parameters:  
  39.   CC       = /usr/bin/llvm-gcc -std=gnu99  
  40.   CFLAGS   = -Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7 -Wall -D_THREAD_SAFE  
  41.   CPPFLAGS = -F/usr/local/Frameworks -I/usr/X11/include -I/usr/local/Cellar/freetype/2.4.10/include/freetype2 -I/usr/include/libxml2  
  42.   CXX      = /usr/bin/llvm-g++  
  43.   CXXFLAGS = -Os -w -pipe -march=core2 -msse4 -mmacosx-version-min=10.7 -D_THREAD_SAFE  
  44.   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  
  45.   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的过程中会出现以下错误:

 

C代码  收藏代码
  1. Undefined symbols for architecture x86_64:  
  2.   "___builtin_object_size", referenced from:  
  3.       _BlurImageScanlines.omp_fn.6 in libGraphicsMagick.a(magick_libGraphicsMagick_la-effect.o)  
  4.       _XShearImage.omp_fn.0 in libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o)  
  5.       _YShearImage.omp_fn.1 in libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o)  
  6. ld: symbol(s) not found for architecture x86_64  
  7. collect2: ld returned 1 exit status  
  8. make[1]: *** [utilities/gm] Error 1  
  9. make: *** [all] Error 2  
  10.   
  11. ----------  
  12. ld: symbol(s) not found for architecture x86_64     
  13. collect2: ld returned 1 exit status     
  14. make[1]: *** [magick/libGraphicsMagick.la] Error 1  
  15. 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

结果:打印出很多信息。

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics