Linux下安装ImageMagick+Jmagick

#++++++安装zlib++++++
./configure --prefix=/usr/local/ --shared
make
make check
make install

#++++++安装libpng++++++
cp scripts/makefile.gcmmx makefile
./confiure --enable-shared --prefix=/usr/local/
若安装机器是64位操作系统,需要在Makefile中修改CFLAGS,添加-fPIC参数
make
make install

#++++++安装libtool++++++
./configure --prefix=/usr/local/
若安装机器是64位操作系统,需要在Makefile中修改CFLAGS,添加-fPIC参数
make
make install

#++++++安装jpeg6++++++
mkdir -pv /usr/local/libjpeg/{,bin,lib,include,man/man1,man1}
cp /usr/local/share/libtool/config/config.sub .
cp /usr/local/share/libtool/config/config.guess .
./configure --prefix=/usr/local/libjpeg/ --enable-shared --enable-static
若安装机器是64位操作系统,需要在Makefile中修改CFLAGS,添加-fPIC参数
make
make install

#++++++安装freetype++++++
#我装的系统是Ubuntu,偷了一下懒
apt-get install libfreetype6-dev

#++++++ImageMagick++++++
./configure --enable-shared --without-perl
make
make install

在/etc/profile中添加
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
   export LD_LIBRARY_PATH

在/etc/ld.so.conf中添加
/usr/local/lib
安装后,可以用下列命令行测试一下是否安装成功

#++++++安装Jmagick++++++
./configure
make all
make install
安装后,可使用下列测试程序验证是否安装成功

import magick.ImageInfo;
import magick.MagickException;
import magick.MagickImage;
import java.io.File;
public class TestJmagick {

/**
* @param args
*/
public static void main(String[] args) {
try{
     ImageInfo info = new ImageInfo(“te.jpg");//在测试程序所在的目录下添加图片te.jp
     MagickImage inputImage = new MagickImage( info );
     inputImage.profileImage("*",null);
     System.setProperty("jmagick.systemclassloader","no");
     MagickImage scaleImg = inputImage.scaleImage( 1024, 768 );//将原始图片放大为1024×768
     scaleImg.setFileName("re.jpg");
     scaleImg.writeImage(info);
  }
  catch(MagickApiException ex){
      System.err.println("MagickException: " + ex + ": " +  ex.getReason() + ", " + ex.getDescription());
       ex.printStackTrace();
   }
   catch(MagickException ex) {
       System.err.println("MagickException: " + ex);
       ex.printStackTrace();
   }
   catch(IOException io ){
   {
        System.err.println("IOException:" + io );
        io.printStackTrace();
   }
}

    

你可能感兴趣的:(linux,ubuntu,perl)