[Java] ImageMagick7 + im4java

less than 1 minute read

Call ImageMagick via im4java. The environment is windows 10.


  • windows 10
  • ImageMagick-7.0.10-21

Source code

implementation 'org.im4java:im4java:1.4.0'
import java.io.IOException;

import org.im4java.core.IM4JavaException;
import org.im4java.core.IMOperation;
import org.im4java.core.ImageMagickCmd;

public class ImageMagickMain {
	public static void main(String[] args) throws IOException, InterruptedException, IM4JavaException {
		ImageMagickCmd magick = new ImageMagickCmd("magick");
		IMOperation operation = new IMOperation();
		operation.addImage("src.png ");
		operation.resize(300, 300);
		operation.addImage("dest.png ");

Precautions with 7 or earlier

Details will come out soon, but from 7 the module name has been changed from convert to magick. Specifically, in windows, it changes from convert.exe` `` to magick.exe. Therefore, in 7, the module name of ImageMagick in the argument of new ImageMagickCmdneeds to be` `magick. Please note that when referring to existing materials.

However, you can still use convert. In that case, it is necessary to check Install legacy utilities as shown below at the time of installation. If you check this, ```convert.exe ` will also be installed.