---
title: "GraphicsMagick在mac系统上的用brew的安装"
author: "stephen830"
date: "2015-05-19T15:54:00Z"
tags: []
categories: ["开源软件"]
slug: "graphicsmagick-mac-brew"
draft: false
lastmod: "2015-05-19T15:55:49Z"
id: 2212526
url: "https://stephen830.iteye.com/blog/2212526"
---

GraphicsMagick在mac系统上的用brew的安装

######################################################  
#   platform: MAC OS  
######################################################

安装jpeg包

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   安装jpeg包  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

sudo brew install libjpeg

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

   
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   安装jasper包  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

sudo brew install jasper

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

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   安装libpng  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

sudo brew install libpng

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

 

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   安装freetype包  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

sudo brew install freetype

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

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   安装zlib包  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

系统自带不用安装了

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   安装GraphicsMagick  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

自动安装：sudo brew install GraphicsMagick

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

 

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   查看安装信息  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
gm -version

-------------- 以下为 gm -version 的输出信息 ------------------------

GraphicsMagick 1.3.21 2015-02-28 Q8 http://www.GraphicsMagick.org/  
Copyright (C) 2002-2014 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 (&gt; 32 bit)   yes  
  Large Memory (&gt; 32 bit)  yes  
  BZIP                     yes  
  DPS                      no  
  FlashPix                 no  
  FreeType                 yes  
  Ghostscript (Library)    no  
  JBIG                     no  
  JPEG-2000                no  
  JPEG                     yes  
  Little CMS               no  
  Loadable Modules         yes  
  OpenMP                   no  
  PNG                      yes  
  TIFF                     no  
  TRIO                     no  
  UMEM                     no  
  WebP                     no  
  WMF                      no  
  X11                      no  
  XML                      no  
  ZLIB                     yes

Host type: x86\_64-apple-darwin13.4.0

Configured using the command:  
  ./configure  '--prefix=/usr/local/Cellar/graphicsmagick/1.3.21' '--disable-dependency-tracking' '--enable-shared' '--disable-static' '--with-modules' '--disable-openmp' '--without-gslib' '--with-gs-font-dir=/usr/local/share/ghostscript/fonts' '--without-x' '--without-lcms' '--without-lcms2' 'CC=clang' 'CXX=clang++'

Final Build Parameters:  
  CC       = clang  
  CFLAGS   = -g -O2 -Wall -D\_THREAD\_SAFE  
  CPPFLAGS = -I/usr/local/Cellar/freetype/2.5.5/include/freetype2  
  CXX      = clang++  
  CXXFLAGS = -D\_THREAD\_SAFE  
  LDFLAGS  = -L/usr/local/Cellar/freetype/2.5.5/lib  
  LIBS     = -lfreetype -lbz2 -lz -lltdl -lm -lpthread  
   
\-------------- 以上为 gm -version 的输出信息 ------------------------

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**  
*   IM4JAVA调用GraphicsMagick 的简单示例  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\**

IM4JAVA下载地址 http://sourceforge.net/projects/im4java/files/  
将IM4JAVA下载文件中的jar文件放到你的java的lib目录下就可以开始使用IM4JAVA了。

-------------- 以下为 IM4JAVA调用GraphicsMagick 的示例代码 ------------------------  
// create command  
ConvertCmd cmd = new ConvertCmd(true); //true表示使用GraphicsMagick ,false表示使用ImageMagick  
cmd.setSearchPath("/usr/local/Cellar/graphicsmagick/1.3.21/bin");//设置 GraphicsMagick的bin目录  
// create the operation, add images and operators/options  
IMOperation op = new IMOperation();  
op.addImage(srcFile);  
op.resize(150,150);  
op.addImage(dstFile);  
// execute the operation  
cmd.run(op);  
\-------------- 以上为 IM4JAVA调用GraphicsMagick 的示例代码 ------------------------