[This article is transferred from the network and made some modifications based on actual operations]
Jmagick installation (based on Windows), lite steps:
1. Download jmagick-win-5.5.7-q8.zip and put jmagick. Jar under the application Lib. Copy jmagick. DLL to system32;
Http://downloads.jmagick.org/5.5.7/
2. Install imagemagick-5.5.7-q8-windows-dll.exe.
Http://sourceforge.net/project/showfiles.php? Group_id = 24099 & package_id = 47692
3. Restart the machine
Troublesome, but the ability to process images is indeed beyond imagination (however, JVM crach is frequently used in version 6.2.6, which is scary)
For jmagick, I only use image scaling.
CodeAs follows:
Code
Package Test;
ImportJava. AWT. dimension;
ImportMagick. imageinfo;
ImportMagick. magickexception;
ImportMagick. magickimage;
Public ClassJmagicktest {
/**
* @ Param ARGs
* @ Throws Magickexception
*/
Public Static Void Main (string [] ARGs) Throws Magickexception {
// Todo auto-generated method stub
System. setproperty ( " Jmagick. systemclassloader " , " No " ); // There's nothing to say about it. Just do it.
String fromfilename = " C: \ 11.gif " ;
String tofilename = " C: \ test.gif " ;
Int Towidth = 200 ;
Imageinfo info = New Imageinfo (fromfilename );
Magickimage fromimage = New Magickimage (Info );
Dimension dim = Fromimage. getdimension ();
Double W = Dim. getwidth ();
Double H = Dim. getheight ();
Int Toheight = ( Int ) (H * Towidth / W ); // Scale by width
Magickimage toimage = Fromimage. scaleimage (towidth, toheight ); // Scaling operation
Toimage. setfilename (tofilename ); // Set output file name
Toimage. writeimage (Info ); // Save
}
}
I found many problems with the latest version, either noclassdeffounderror or can't find dependent libraries.
Then downgrade to 5.5.7, which means that the idea of only the latest version of it is not necessarily correct.
Attached javadoc address:
Http://downloads.jmagick.org/jmagick-doc/