Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image magick java

Tags:

How can I modify image from java through ImageMagick? Is there any way of doing it?

like image 771
rahul the great Avatar asked Mar 01 '11 04:03

rahul the great


People also ask

What Does ImageMagick do?

ImageMagick is open-source software that is used to create and edit images. It is used to edit bitmap images of 200 formats. It's available for free software that can be used as source code with a ready-run binary distribution feature.

Is GraphicsMagick better than ImageMagick?

We found that GraphicsMagick was usually considerably faster at executing image processing operations from the command line than ImageMagick 6.5. 8-10 was. One ImageMagick algorithm ran as much as 770 times slower. GraphicsMagick clearly ran much more efficiently under Microsoft Windows.

Does ImageMagick have GUI?

Left-clicking on an image brings up a simple, standalone menu (the only GUI feature you'll see in ImageMagick).

What is ImageMagick package?

ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF.


2 Answers

How to Install JMajick on Windows

  1. Go to http://downloads.jmagick.org/6.3.9/ (or any other version of your choice)
  2. Download ImageMagick-6.3.9-0-Q8-windows-dll.exe and jmagick-win-6.3.9-Q8.zip.
  3. Install the exe file. This will install ImageMagick which is a prerequisite for JMagick to work.
  4. Now extract the zip file. This will give jmagick.dll and jmagick.jar.
  5. Copy the jmagick.jar to you lib folder and include it in the classpath.
  6. Copy the jmagick.dll to the root installation directory of ImageMagic and add it as an entry to the PATH environment variable.
  7. JMagick is installed :).
like image 39
Anand Avatar answered Nov 13 '22 23:11

Anand


Use JMagick (docs). Read the documentation. It provides all the functionality of ImageMagick. You may also look into another ImageMagick Java wrapper, im4java.

There is a good starters document for im4java here


Here is an example, I've worked out.

/** Typical scaling implementation using JMagick **/ ImageInfo origInfo = new ImageInfo(absPath); //load image info MagickImage image = new MagickImage(origInfo); //load image image = image.scaleImage(finalWidth, finalHeight); //to Scale image image.setFileName(absNewFilePath); //give new location image.writeImage(origInfo); //save 

Edit #1:

If you are wondering for the Jar file of JMagick. Download jMagick tarball, untar it.

$ tar xvzf jmagick-linux-6.4.0-Q32.tar.gz  ./jmagick-6.4.0.jar ./jmagick.jar ./libJMagick-6.4.0.so ./libJMagick.so 
like image 193
Nishant Avatar answered Nov 13 '22 22:11

Nishant