Chinaunix首页 | 论坛 | 博客
  • 博客访问: 639758
  • 博文数量: 263
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 2555
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-26 11:20
文章分类

全部博文(263)

文章存档

2011年(10)

2010年(19)

2009年(170)

2008年(64)

我的朋友

分类:

2008-11-06 10:17:35

Installing ImageMagick with FreeType, PNG, JPEG, AI and EPS Support

Often a client will request some type of image manipulation performed server side to support their application. A common example of this is the simple 'add watermark' function that you see on so many sites, but the examples can quickly get more complicated including items such as sharpen, add text, overlay images, overlay eps drawings etc...

For more complicated image manipulation applications you need to move to a larger solution than the built-in image handlers in most languages. For just such an occasion we settled on the ImageMagick library, with associated extensions. We are communicating with ImageMagick using php and the image magick libraries, but the focus of this article is the ImageMagick setup itself. Generally, we found the environment to be tricky to configure and not very well documented.

Without going into unnecessary detail about the various challenges we faced, we'd like to provide a rough guide to setting up this environment. The most significant problem solving came around how ImageMagick finds its delegates (jpeg, jasper, libpng, ghostscript). Essentially ImageMagick expects these to be found within an 'ext' directory within the build source tree, that is not created by default.

Building the system in the /tmp directory on a clean linux system (we used a fresh install of , Respin 1) you should be able to follow these directions:

1) "Get" your copy of ImageMagick.
>wget ftp://ftp.imagemagick.net/pub/ImageMagick/ImageMagick-6.2.9-8.tar.gz

2) Get your .
- These are add-ons that will handle various formats/functions for ImageMagick.

For jpeg support
>wget wget ftp://Ztp.imagemagick.org/pub/ImageMagick/delegates/jpegsrc.v6b.tar.gz
For jpeg2000 support
>wget wget ftp://ftp.imagemagick.org/pub/ImageMagick/delegates/jasper-1.701.0.zip
For PNG support
>wget ftp://ftp.imagemagick.org/pub/ImageMagick/delegates/libpng-1.2.12.tar.gz
For GhostScript eps / ai support
>wget
For GhostScript fonts support
>wget

3) Extract all of the Delegates.
- Copy the ghostscript fonts to the default dir.
>mkdir /usr/local/share/ghostscript/fonts
>cp ./ghostscript-fonts-std-8.11/* /usr/local/share/ghostscript/fonts/

4) Make an ‘ext’ directory in ImageMagick.
>mkdir ./ImageMagick-6.2.9-8/ext

5) Copy all the delegate folders to the 'ext' directory and give them nicer names such as:
jpeg
jasper
libpng
ghostscript

6) Configure and build each of your delegates.
>cd /tmp/ImageMagick-6.2.9-8/ext/jpeg
>./configure
>build

Repeat this for each of the delegates

7) Copy the jpeg folder into the ghostscript folder.
>cd /tmp/ImageMagick-6.2.9-8/ext/ghostscript
>./configure
>build
>cd /tmp/ImageMagick-6.2.9-8/ext/jasper

>./configure
>build
>cd /tmp/ImageMagick-6.2.9-8/ext/libpng

>./configure
>build

8) Create a text file for the configuration parameters for ImageMagick
>cd /tmp/ImageMagick-6.2.9-8/
>touch myconf
>vi myconf

- Here are the contents of our configuration file, have a look and make sure it matches your environment

./configure –with-windows-font-dir=/usr/share/fonts/monotype/TrueType –enable-shared –with-exif=yes –enable-lzw=yes –with-gs-font-dir=/usr/local/share/ghostscript/fonts -without-x CPPFLAGS=’-I/tmp/ImageMagick-6.2.9/ext/jpeg -I/tmp/ImageMagick-6.2.9/ext/libpng -I/tmp/ImageMagick-6.2.9/ext/jasper’ LDFLAGS=’-L/tmp/ImageMagick-6.2.9/ext/jpeg -L/tmp/ImageMagick-6.2.9/ext/libpng -L/tmp/ImageMagick-6.2.9/ext/jasper -lfreetype’

9) Run Configure
>./myconf > configure.log

- After configuration, inspect the configure.log , with any luck it will look like this. As you can see jpeg2000 failed which was not a concern to our project, but possibly if you did a make build on jasper before configuring Imagemagick it would work.

Shared libraries  –enable-shared=yes        yes
Static libraries  –enable-static=yes        yes
Module support    –with-modules=yes        yes
GNU ld            –with-gnu-ld=yes        yes
Quantum depth     –with-quantum-depth=16    16

Delegate Configuration:

BZLIB             –with-bzlib=yes        yes
DPS               –with-dps=yes        no
FlashPIX          –with-fpx=no        no
FontConfig        –with-fontconfig=no        no
FreeType          –with-freetype=yes        yes
GhostPCL          None                pcl6 (unknown)
Ghostscript       None                gs (8.15)
Ghostscript fonts –with-gs-font-dir=/usr/local/share/ghostscript/fonts    /usr/local/share/ghostscript/fonts/
Ghostscript lib   –with-gslib=yes        no
Graphviz          –with-gvc=yes        no
JBIG              –with-jbig=yes        no
JPEG v1           –with-jpeg=yes        yes
JPEG-2000         –with-jp2=yes        no
LCMS              –with-lcms=yes        no
Magick++          –with-magick-plus-plus=yes    yes
PERL              –with-perl=yes        /usr/bin/perl
PNG               –with-png=yes        yes
RSVG              –with-rsvg=no        no
TIFF              –with-tiff=yes        no
Windows fonts     –with-windows-font-dir=/usr/share/fonts/monotype/TrueType    /usr/share/fonts/monotype/TrueType/
WMF               –with-wmf=yes        no
X11               –with-x=no            no
XML               –with-xml=yes        yes
ZLIB              –with-zlib=yes        yes

10) Now run the "make" command.
>make && make install

- NOTE - This will take a long time.

11) On a succssesful build, you should be able to run this command line

>convert -background green  -fill white -font Arial  -size 165x40  label:"Codesta.Com" ImageMagickTest.gif

- Producing This Image

Imagemagicktest



For more examples of ImageMagick Useage, check here.

Related Links

White Box Linux -
Image Magic - http://www.imagemagick.org  
The Image Magick delegates repository -
GhostScript -
GhostScript Fonts -
Jpeg Libraries - ftp://Ztp.imagemagick.org/pub/ImageMagick/delegates/jpegsrc.v6b.tar.gz
Jasper (Jpeg2000 libraries) - ftp://ftp.imagemagick.org/pub/ImageMagick/delegates/jasper-1.701.0.zip
PNG Libraries - ftp://ftp.imagemagick.org/pub/ImageMagick/delegates/libpng-1.2.12.tar.gz

TrackBack

TrackBack URL for this entry:

Listed below are links to weblogs that reference Installing ImageMagick with FreeType, PNG, JPEG, AI and EPS Support:


Get the lists of the imagick delegates, follow this

阅读(2764) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~