Install jmagick in centos 6

Source: Internet
Author: User
Tags imagemagick

I recently used Java to write a program for image operations. Although Java's ImageIO can implement the same function, the efficiency is obviously not comparable to that of C's ImageMagick. Jmagick is an open-source API that uses JNI (Java Native Interface) technology to implement Java access interfaces for ImageMagick APIs. However, currently, jmagick only implements some functions of imagemagic APIs. Jmagick documentation: http://www.jmagick.org/jmagick-doc/

I use centos 6.5. First, check the installed jmagick package. If yes, uninstall the old package.

 
Rpm-Qa |GrepImagemagickrpm-Qa |GrepJmagick

The installation section is as follows:

1. Check the installation status of the dependent package first.

 
Rpm-Q libjpeg-devel libpng-devel LibTIFF-devel libungif-develPerl-CPAN Perl make gcc

Run the following command to install uninstalled packages.

Yum   Install  Libjpeg  Yum   Install Libjpeg- Devel  Yum   Install  Libpng  Yum   Install Libpng- Devel  Yum   Install  LibTIFF  Yum  Install LibTIFF- Devel  Yum   Install  Libungif  Yum   Install Libungif- Devel  Yum   Install   Perl-CPAN 

I used libjpeg-Turbo to replace libjpeg, and giflib to replace libungif.

2. download the new versions of ImageMagick and jmagick.

WgetHTTP://Www.jmagick.org/6.4.0/imagemagick-6.4.0-0.tar.gzWgetHTTP://Www.jmagick.org/6.4.0/jmagick-6.4.0-src.tar.gz

3. Install ImageMagick

 
Tar-XzvfImageMagick-6.4.0-0.tar.gzMkdir/Usr/local/ImagemagickcdImagemagIck-6.4.0-0./Configure -- prefix =/usr/local/ImageMagick/MakeMake Install

Configure the environment variable, export Path =/usr/local/ImageMagick/bin: $ path

VI/Etc/Profilesource/Etc/profile

Check whether the installation is successful and enter convert.

4. Install jmagick

 
Tar-Xzvf JMAgick-6.4.0-src.tar. Gzcd6.4.0./ConfigureMakeMake InstallCD libCP*. So/usr/lib

Load the so library file path to the configuration file Add:/usr/local/ImageMagick/lib

 
VI/Etc/LD. So. confldconfig

Copy libjmagick. So to the amd64 directory of JDK. Copy jmagick. jar to the JDK ext directory.

 
CP/Usr/local/jmagick/lib/libjmagick. So/Usr/Java/jdk1.6.0 _ 32/JRE/lib/amd64/CP/Usr/local/jmagick/lib/JMAGick-6.4.0.jar/usr/Java/jdk1.6.0 _ 32/JRE/lib/EXT/

NOTE: If your centos is 64-bit, JDK also needs to install 64-bit. Otherwise, calling jmagick. jar in the program will not succeed!

5. Use the jmagick library in Java programs

The following code must be added to the program to run properly.

 
System. setproperty ("jmagick. systemclassloader", "no ");

Finally, you can use the jmagick library successfully. If you have any questions, leave a message.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.