Error in calling ImageMagick from Matlab

2019-08-05 01:29发布

问题:

I have installed ImageMagick in my system (windows), and its commands are there in system PATH. Its working absolutely fine through Command line I want to call the "convert" function of ImageMagick from Matlab using system command. 'C:\Users\Vivek' is the Path to image. I have to test working of ImageMagick through Matlab, as i need it in further processing (Making input suitable to Tesseract OCR)

    cmd= ['convert ' 'C:\Users\Vivek\208.jpg ' 'C:\Users\Vivek\208.png']
    system(cmd);

It says Invalid Parameter - C:\Users\Vivek\208.png, I tried some other ways. But, all the time the problem is with the second parameters.

Need Help

Thanks

回答1:

Windows comes with its own convert program, and it looks like you're calling that one because it's first on the path in this context. It's described here on ImageMagick's site: http://www.imagemagick.org/Usage/windows/#convert_issue

I do not have ImageMagick installed, and I get the same error message when I try calling convert. That's consistent with your code getting the wrong convert program.

C:\Users\janke>convert C:\Users\Vivek\286.jpg C:\Users\Vivek\208.png
Invalid Parameter - C:\Users\Vivek\208.png

Specify the full path to ImageMagick's convert program and it should work for you.



回答2:

The solution mentioned in the last post is the standard way to solve the issue, but the simplest way to do this is to just rename the ImageMagick's convert.exe file to something else, like convert1.exe, and use this filename in your scripts.