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
It runs on Linux, Windows, Mac Os X, iOS, Android OS, and others. The authoritative ImageMagick version 6 web site is https://legacy.imagemagick.org. The authoritative source code repository is https://github.com/ImageMagick/ImageMagick6. Find the latest release of ImageMagick, version 7, at https://imagemagick.org.
ImageMagick is a raster processor, not a vector to vector processor. So if you have a vector PDF and you convert it to PDF using ImageMagick, it will rasterize the PDF to pixels (not vectors) and imbed the raster image in a vector PDF shell. That will make the output much larger than the input.
If you have the free command-line tool ImageMagick installed on your computer, you can convert an HEIC file to any other format using the convert tool.
Use ImageMagick® to create, edit, compose, or convert digital images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.
Three options:
magick
R package instead of using system()
.convert ...
to magick convert ...
.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:
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 ..."
).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With