Where is convert in ImageMagick?

99封情书 提交于 2021-02-07 18:20:49

问题


I just spent an infuriating day trying to make a gif out of a series of jpg files in R. I installed ImageMagick to run the following code:

system("convert -delay 40 *.png example_4.gif")

but I get the following error message:

Warning message:
running command 'convert -delay 40 *.png example_4.gif' had status 4

which looks like a path error. Now I've looked for convert in the Imagemagick download and can't see it anywhere. Does anyone know where it is?

Alternately, is there another easier method of making a gif from a series of jpegs in R that isn't ridiculously long?

Thanks


回答1:


Three options:

  1. Consider using the magick R package instead of using system().
  2. Change your script from convert ... to magick convert ....
  3. Re-install imagemagick, and enable the "Install legacy utilities (e.g. convert)" option.

This change has been around since 7.0.1 (now up to 7.0.7), and is discussed in their porting guide, specifically in the section entitled "Command Changes".

Philosophically, I prefer to not install the legacy utilities, mostly because it can cause some confusion with command names. For instance, the non-ImageMagick convert.exe in windows tries to convert a filesystem ... probably not what you want to accidentally trigger (there is a very low chance that you could get the arguments right to actually make a change, but it's still not 0). The order of directories in your PATH will dictate which you are calling.

EDITs:

  1. From comments, it seems like the difference between "static" and "dll" installers might disable the option to install legacy utilities such as convert.exe. So you can either switch to the "dll" to get the legacy option, or you are restricted to options 1 (magick R package) and 2 ("magick convert ...").

  2. From further comments (thanks to fmw42 and MarkSetchell), it is clear that the old convert.exe and the current legacy mode of magick.exe convert are not the same as the currently recommended magick.exe (without "convert"); the first two are legacy and compatibility modes, but they do not accept all arguments currently supported by magick-alone. So the use of "convert" anywhere in the command should indicate use of v6, not the current v7. This answer is then merely a patch for continued use of the v6 mechanisms; one could argue a better solution would be to use magick.exe's v7 interface, completely removing the "convert" legacy mode.



来源:https://stackoverflow.com/questions/46059436/where-is-convert-in-imagemagick

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!